nav-logo.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <view>
  3. <u-navbar
  4. :class="title ? 'navbarL' : 'navbarC'"
  5. :is-back="false"
  6. :title="title"
  7. :border-bottom="false"
  8. title-color="#333333"
  9. back-icon-color="#ffffff"
  10. >
  11. <view class="slot-wrap">
  12. <image
  13. :src="$method.splitImgHost(config.h5Logo)"
  14. @load="load"
  15. :style="{ width: imgwidth + 'rpx', height: imgheight + 'rpx' }"
  16. />
  17. </view>
  18. </u-navbar>
  19. </view>
  20. </template>
  21. <script>
  22. import { mapGetters } from "vuex";
  23. export default {
  24. name: "NavLogo",
  25. props: {
  26. title: {
  27. type: String,
  28. default: "",
  29. },
  30. },
  31. data() {
  32. return {
  33. imgwidth: 0,
  34. imgheight: 0,
  35. };
  36. },
  37. mounted() {},
  38. computed: {
  39. ...mapGetters(["userInfo", "config"]),
  40. },
  41. methods: {
  42. load(e) {
  43. this.imgwidth = e.detail.width;
  44. this.imgheight = e.detail.height;
  45. },
  46. },
  47. };
  48. </script>
  49. <style lang="scss" scoped>
  50. .navbarL {
  51. image {
  52. margin-left: 30rpx;
  53. }
  54. img {
  55. margin-left: 30rpx;
  56. }
  57. }
  58. .navbarC {
  59. /deep/ .u-navbar-inner {
  60. margin-right: 0 !important;
  61. }
  62. .slot-wrap {
  63. width: 100vw;
  64. display: flex;
  65. align-items: center;
  66. justify-content: center;
  67. image {
  68. width: 178rpx;
  69. height: 31rpx;
  70. }
  71. }
  72. }
  73. </style>