titles.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <view class="index-wrapper" :class="{'off': sty ==='off'}">
  3. <view class='titles' v-if="isIframe && !titleConfig.length">{{$t(`暂无标题`)}}</view>
  4. <view class='title acea-row row-between-wrapper' v-if="isShow && titleConfig.length && !isIframe">
  5. <view class='text'>
  6. <view class='name line1'>{{titleConfig[0].val}}</view>
  7. <view class='line1 txt-btn'>{{$t(`诚意推荐品质商品`)}}</view>
  8. </view>
  9. <navigator hover-class="none" :url="titleConfig[1].val" class='more'>
  10. {{$t(`更多`)}}
  11. <text class='iconfont icon-jiantou'></text>
  12. </navigator>
  13. </view>
  14. <view class='title acea-row row-between-wrapper' v-if="isIframe && titleConfig.length">
  15. <view class='text'>
  16. <view class='name line1'>{{titleConfig[0].val}}</view>
  17. <view class='line1 txt-btn'>{{$t(`诚意推荐品质商品`)}}</view>
  18. </view>
  19. <view class='more'>
  20. {{$t(`更多`)}}
  21. <text class='iconfont icon-jiantou'></text>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. let app = getApp()
  28. export default {
  29. name: 'titles',
  30. props: {
  31. dataConfig: {
  32. type: Object,
  33. default: () => {}
  34. },
  35. sty: {
  36. type: String,
  37. default: 'on'
  38. }
  39. },
  40. watch: {
  41. dataConfig: {
  42. immediate: true,
  43. handler(nVal, oVal) {
  44. if (nVal) {
  45. this.titleConfig = nVal.titleInfo.list;
  46. this.isShow = nVal.isShow.val;
  47. }
  48. }
  49. }
  50. },
  51. data() {
  52. return {
  53. titleConfig: {},
  54. name: this.$options.name,
  55. isIframe: false,
  56. isShow: true
  57. };
  58. },
  59. created() {
  60. this.isIframe = app.globalData.isIframe;
  61. },
  62. mounted() {},
  63. methods: {}
  64. }
  65. </script>
  66. <style lang="scss">
  67. .titles {
  68. font-size: 35rpx;
  69. color: #282828;
  70. text-align: center;
  71. width: 100%;
  72. }
  73. .title {
  74. padding: 30rpx 0;
  75. .text {
  76. display: flex;
  77. .name{
  78. font-size: 32rpx;
  79. font-weight: bold;
  80. }
  81. .txt-btn {
  82. display: flex;
  83. align-items: flex-end;
  84. margin-bottom: 6rpx;
  85. margin-left: 12rpx;
  86. }
  87. }
  88. }
  89. .index-wrapper {
  90. background-color: $uni-bg-color;
  91. margin: $uni-index-margin-row $uni-index-margin-col;
  92. border-radius: $uni-border-radius-index;
  93. }
  94. .off {
  95. border-radius: $uni-border-radius-index $uni-border-radius-index 0 0 !important;
  96. margin-bottom: 0 !important;
  97. }
  98. </style>