index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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 list" :key="index" @tap="toPath(index,item)" v-if="item.is_use=='0'">
  12. <image class="image" :src="item.normal.length>0?item.normal[0].url:''" mode="" v-if="active!=index"></image>
  13. <image class="image" :src="item.active.length>0?item.active[0].url:''" 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. list: [],
  29. active: 0,
  30. };
  31. },
  32. created: function() {
  33. const that = this;
  34. that.search()
  35. },
  36. methods: {
  37. search() {
  38. const that = this;
  39. let pages = getCurrentPages();
  40. let currentPage = pages[pages.length - 1];
  41. uni.getStorage({
  42. key: 'config',
  43. success: function(res) {
  44. if (res.data) {
  45. let bottom_menu = res.data.bottom_menu;
  46. let list = bottom_menu.list.sort((a, b) => {
  47. return a.sort - b.sort
  48. });
  49. that.$set(that, `list`, list);
  50. let data = list.find((i) => i.route == currentPage.route);
  51. if (data) {
  52. let index =
  53. list.findIndex((i) => i.route == currentPage.route);
  54. that.$set(that, `active`, index);
  55. }
  56. }
  57. },
  58. fail: function(err) {
  59. console.log(err);
  60. }
  61. })
  62. },
  63. toPath(index, item) {
  64. const that = this;
  65. that.$set(that, `active`, index);
  66. that.$emit('toPath', item)
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="scss">
  72. .body {
  73. .info {
  74. position: relative;
  75. flex-grow: 1;
  76. }
  77. .foot {
  78. height: 8vh;
  79. overflow: hidden;
  80. background-color: var(--fffColor);
  81. display: flex;
  82. flex-direction: row;
  83. justify-content: space-around;
  84. border-top: 1px solid var(--f1Color);
  85. .list {
  86. padding: 1vw 0;
  87. text-align: center;
  88. .image {
  89. width: 7vw;
  90. height: 6vw;
  91. }
  92. .name {
  93. font-size: 12px;
  94. }
  95. }
  96. }
  97. }
  98. .scroll-view {
  99. position: absolute;
  100. top: 0;
  101. left: 0;
  102. right: 0;
  103. bottom: 0;
  104. .list-scroll-view {
  105. display: flex;
  106. flex-direction: column;
  107. }
  108. }
  109. </style>