index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <view class="container body">
  3. <view class="info">
  4. <scroll-view scroll-y="true" class="scroll-view">
  5. <view class="list-scroll-view">
  6. <slot></slot>
  7. </view>
  8. </scroll-view>
  9. </view>
  10. <view class="foot" v-if="frameStyle&&frameStyle.useBar||false">
  11. <view class="list" v-for="(item,index) in barList" :key="index" @tap="toPath(index,item)" v-if="item.is_use=='0'">
  12. <image class="image" :src="item.normal" mode="" v-if="active!=index"></image>
  13. <image class="image" :src="item.active" mode="" v-else></image>
  14. <view class="name" :style="{color:active==index?frameStyle.barActive||'#FB1438':''}">{{item.name}}</view>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. props: {
  22. frameStyle: {
  23. type: Object,
  24. },
  25. },
  26. data() {
  27. return {
  28. active: 0,
  29. barList: [{
  30. name: '首页',
  31. route: 'pages/home/index',
  32. normal: require('@/static/shouye.png'),
  33. active: require('@/static/shouye_1.png'),
  34. type: '0',
  35. is_use: '0'
  36. },
  37. {
  38. name: '微店',
  39. route: 'pages/store/index',
  40. normal: require('@/static/store.png'),
  41. active: require('@/static/store_1.png'),
  42. type: '0',
  43. is_use: '1'
  44. },
  45. {
  46. name: '分类',
  47. route: 'pages/week/index',
  48. normal: require('@/static/type.png'),
  49. active: require('@/static/type_1.png'),
  50. type: '0',
  51. is_use: '0'
  52. },
  53. {
  54. name: '购物车',
  55. route: 'pages/market/index',
  56. normal: require('@/static/market.png'),
  57. active: require('@/static/market_1.png'),
  58. type: '0',
  59. is_use: '0'
  60. },
  61. {
  62. name: '我的',
  63. route: 'pages/my/index',
  64. normal: require('@/static/my.png'),
  65. active: require('@/static/my_1.png'),
  66. type: '0',
  67. is_use: '0'
  68. },
  69. ]
  70. };
  71. },
  72. created: function() {
  73. const that = this;
  74. that.search()
  75. },
  76. onShow: function() {},
  77. methods: {
  78. search() {
  79. const that = this;
  80. let pages = getCurrentPages();
  81. let currentPage = pages[pages.length - 1];
  82. let index = that.barList.findIndex((i) => i.route == currentPage.route);
  83. if (index) that.$set(that, `active`, index);
  84. },
  85. toPath(index, item) {
  86. const that = this;
  87. that.$set(that, `active`, index);
  88. that.$emit('toPath', item)
  89. }
  90. }
  91. }
  92. </script>
  93. <style lang="scss">
  94. .body {
  95. .info {
  96. position: relative;
  97. flex-grow: 1;
  98. }
  99. .foot {
  100. height: 8vh;
  101. overflow: hidden;
  102. background-color: var(--fffColor);
  103. display: flex;
  104. flex-direction: row;
  105. justify-content: space-around;
  106. border-top: 1px solid var(--f1Color);
  107. .list {
  108. padding: 1vw 0;
  109. text-align: center;
  110. .image {
  111. width: 7vw;
  112. height: 6vw;
  113. }
  114. .name {
  115. font-size: 12px;
  116. }
  117. }
  118. }
  119. }
  120. .scroll-view {
  121. position: absolute;
  122. top: 0;
  123. left: 0;
  124. right: 0;
  125. bottom: 0;
  126. .list-scroll-view {
  127. display: flex;
  128. flex-direction: column;
  129. }
  130. }
  131. </style>