nav-logo.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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" v-if="isShowLogo">
  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. isShowLogo: {
  31. type: Boolean,
  32. default: false,
  33. },
  34. },
  35. data() {
  36. return {
  37. imgwidth: 0,
  38. imgheight: 0,
  39. };
  40. },
  41. mounted() {},
  42. computed: {
  43. ...mapGetters(["userInfo", "config"]),
  44. },
  45. methods: {
  46. load(e) {
  47. this.imgwidth = e.detail.width;
  48. this.imgheight = e.detail.height;
  49. },
  50. },
  51. };
  52. </script>
  53. <style lang="scss" scoped>
  54. .navbarL {
  55. image {
  56. margin-left: 30rpx;
  57. }
  58. img {
  59. margin-left: 30rpx;
  60. }
  61. }
  62. .navbarC {
  63. /deep/ .u-navbar-inner {
  64. margin-right: 0 !important;
  65. }
  66. .slot-wrap {
  67. width: 100vw;
  68. display: flex;
  69. align-items: center;
  70. justify-content: center;
  71. image {
  72. width: 178rpx;
  73. height: 31rpx;
  74. }
  75. }
  76. }
  77. </style>