navigation.vue 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view :class="{'padding-lr':showStyle!=='0px'}">
  3. <view v-if="storage" class="bg-white">
  4. <view :class="{'padding-lr':bannerShowStyle!=='0px'}">
  5. <image @click="naviageToPage(indexBanner.url)" :src="image"
  6. :mode="bannerImgStyle==='cover'?'aspectFill':'scaleToFill'"
  7. style="width: 100%;height:174rpx ;padding-top: 8rpx;"></image>
  8. </view>
  9. <view class="cate-section" :style="{backgroundColor:bgColor}">
  10. <view v-for="(item, index) in categoryButtomList" :key="index"
  11. @click="naviageToPage(item.url+('&id='+item.id),item.title)" class="cate-item" :style={color:fontColor}>
  12. <image :src="JSON.parse(item.imgUrl)[0].url" :style="{borderRadius: iconStyle}"></image>
  13. <text>{{item.title}}</text>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. name: 'Navigation',
  22. props: ['storage', 'categoryButtomList', 'options'],
  23. computed: {
  24. bannerShowStyle() {
  25. return this.options.banner.showStyle
  26. },
  27. bannerImgStyle() {
  28. return this.options.banner.imgStyle
  29. },
  30. showStyle() {
  31. return this.options.showStyle
  32. },
  33. fontColor() {
  34. return this.options.fontColor
  35. },
  36. bgColor() {
  37. return this.options.bgColor
  38. },
  39. image() {
  40. const {
  41. image
  42. } = this.options.banner
  43. if (image) {
  44. return JSON.parse(image)[0].url
  45. } else {
  46. return 'https://nontax.oss-cn-beijing.aliyuncs.com/kxmall/G2urVA.png'
  47. }
  48. },
  49. iconStyle() {
  50. return this.options.iconStyle
  51. }
  52. },
  53. methods: {
  54. naviageToPage(url, title) {
  55. this.$emit('naviage-to-page', url, title)
  56. }
  57. }
  58. }
  59. </script>
  60. <style scoped lang="scss">
  61. /* 分类 */
  62. .cate-section {
  63. display: flex;
  64. //justify-content: space-around;
  65. align-items: center;
  66. flex-wrap: wrap;
  67. padding-top: 34rpx;
  68. // padding: 30upx 25upx;
  69. background-color: #fff;
  70. justify-content: space-evenly;
  71. .cate-item {
  72. display: flex;
  73. flex-direction: column;
  74. align-items: center;
  75. width: 138rpx;
  76. padding-bottom: 24rpx;
  77. font-size: $font-sm + 2upx;
  78. color: $font-color-dark;
  79. }
  80. /* 原图标颜色太深,不想改图了,所以加了透明度 */
  81. image {
  82. width: 86upx;
  83. height: 86upx;
  84. margin-bottom: 24upx;
  85. border-radius: 8rpx;
  86. opacity: .7;
  87. // box-shadow: 4upx 4upx 20upx rgba(250, 67, 106, 0.3);
  88. }
  89. }
  90. </style>