nav-logo.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. <!-- #ifdef H5 -->
  13. <img :src="$method.splitImgHost(config.h5Logo)" alt="" srcset="" />
  14. <!-- #endif -->
  15. <!-- #ifdef MP-WEIXIN -->
  16. <image
  17. :src="$method.splitImgHost(config.h5Logo)"
  18. @load="load"
  19. :style="{ width: imgwidth + 'rpx', height: imgheight + 'rpx' }"
  20. />
  21. <!-- #endif -->
  22. </view>
  23. </u-navbar>
  24. </view>
  25. </template>
  26. <script>
  27. import { mapGetters } from "vuex";
  28. export default {
  29. name: "NavLogo",
  30. props: {
  31. title: {
  32. type: String,
  33. default: "",
  34. },
  35. },
  36. data() {
  37. return {
  38. imgwidth: 0,
  39. imgheight: 0,
  40. };
  41. },
  42. mounted() {},
  43. computed: {
  44. ...mapGetters(["userInfo", "config"]),
  45. },
  46. methods: {
  47. load(e) {
  48. console.log(e.detail);
  49. this.imgwidth = e.detail.width * 2;
  50. this.imgheight = e.detail.height * 2;
  51. },
  52. },
  53. };
  54. </script>
  55. <style lang="scss" scoped>
  56. .navbarL {
  57. image {
  58. margin-left: 30rpx;
  59. }
  60. img {
  61. margin-left: 30rpx;
  62. }
  63. }
  64. .navbarC {
  65. /deep/ .u-navbar-inner {
  66. margin-right: 0 !important;
  67. }
  68. .slot-wrap {
  69. width: 100vw;
  70. display: flex;
  71. align-items: center;
  72. justify-content: center;
  73. image {
  74. width: 178rpx;
  75. height: 31rpx;
  76. }
  77. }
  78. }
  79. </style>