menus.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view class="menu-main">
  3. <view class='nav acea-row acea-row' v-if="isShow && menus.length">
  4. <block v-for="(item,index) in menus" :key="index">
  5. <view class='item' @click="menusTap(item.info[1].value)">
  6. <view class='pictrue'>
  7. <easy-loadimage mode="widthFix" :image-src='item.img'></easy-loadimage>
  8. <!-- <image class="skeleton-radius" :src='item.img'></image> -->
  9. </view>
  10. <view class="menu-txt">{{$t(item.info[0].value)}}</view>
  11. </view>
  12. </block>
  13. </view>
  14. <view class='nav acea-row acea-row' v-if="!isShow && isIframe && menus.length">
  15. <block v-for="(item,index) in menus" :key="index">
  16. <view class='item' @click="menusTap(item.info[1].value)">
  17. <view class='pictrue'>
  18. <image :src='item.img'></image>
  19. </view>
  20. <view class="menu-txt">{{item.info[0].value}}</view>
  21. </view>
  22. </block>
  23. </view>
  24. <view class="nav acea-row acea-row" v-if="isIframe && !menus.length">
  25. <view class='item'>
  26. <view class='pictrue default'>
  27. <text class="iconfont icon-icon25201"></text>
  28. </view>
  29. <view class="menu-txt">{{$t(`默认`)}}</view>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. let app = getApp()
  36. import {
  37. goPage
  38. } from '@/libs/order.js'
  39. export default {
  40. name: 'menus',
  41. props: {
  42. dataConfig: {
  43. type: Object,
  44. default: () => {}
  45. }
  46. },
  47. watch: {
  48. dataConfig: {
  49. immediate: true,
  50. handler(nVal, oVal) {
  51. if (nVal) {
  52. this.menus = nVal.imgList.list;
  53. this.isShow = nVal.isShow.val
  54. }
  55. }
  56. }
  57. },
  58. data() {
  59. return {
  60. menus: [],
  61. name: this.$options.name,
  62. isIframe: false,
  63. isShow: true
  64. };
  65. },
  66. created() {
  67. this.isIframe = app.globalData.isIframe;
  68. },
  69. mounted() {},
  70. methods: {
  71. menusTap(url) {
  72. goPage().then(res => {
  73. this.$util.JumpPath(url);
  74. })
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang="scss">
  80. .menu-main {
  81. background-color: #fff;
  82. }
  83. .nav {
  84. margin: 0 30rpx;
  85. // margin: $uni-index-margin-row $uni-index-margin-col;
  86. border-radius: $uni-border-radius-index;
  87. // box-shadow: $uni-index-box-shadow;
  88. .item {
  89. margin-top: 26rpx;
  90. width: 20%;
  91. text-align: center;
  92. font-size: 24rpx;
  93. .pictrue {
  94. width: 90rpx;
  95. height: 90rpx;
  96. margin: 0 auto;
  97. &.default {
  98. background-color: #ccc;
  99. border-radius: 50%;
  100. text-align: center;
  101. line-height: 90rpx;
  102. .iconfont {
  103. font-size: 40rpx;
  104. }
  105. }
  106. /deep/,
  107. /deep/image,
  108. /deep/.easy-loadimage,
  109. /deep/uni-image {
  110. width: 90rpx;
  111. height: 90rpx;
  112. border-radius: 50%;
  113. }
  114. }
  115. .menu-txt {
  116. margin-top: 15rpx;
  117. }
  118. &.four {
  119. width: 25%;
  120. .pictrue {
  121. width: 90rpx;
  122. height: 90rpx;
  123. }
  124. }
  125. }
  126. }
  127. </style>