index.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <view>
  3. <u-tabbar :value="tabbarValues" @change="name => tabbarValues = name" :fixed="true" :placeholder="true"
  4. :safeAreaInsetBottom="true" :border="false">
  5. <u-tabbar-item :text="item.text" v-for="(item,index) in list" :key="index" @click="changeTabbars">
  6. <image class="u-page__item__slot-icon" slot="active-icon" :src="item.activeImg"></image>
  7. <image class="u-page__item__slot-icon" slot="inactive-icon" :src="item.inactiveImg"></image>
  8. </u-tabbar-item>
  9. </u-tabbar>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. props: {
  15. tabbarid: 0
  16. },
  17. data() {
  18. return {
  19. tabbarValues: 0,
  20. list: [{
  21. activeImg: 'https://i.ringzle.com/file/20240106/57895bbc5414416ea5de2a537ed23dc3.png',
  22. inactiveImg: 'https://i.ringzle.com/file/20240106/29bd09ef7eb748f1820c335f86f74c61.png',
  23. text: '首页',
  24. paths: '/pagesHouse/home/index'
  25. },
  26. {
  27. activeImg: 'https://i.ringzle.com/file/20240106/584d0a4108c44fa5bc566d0d0082e07d.png',
  28. inactiveImg: 'https://i.ringzle.com/file/20240106/9561cd3843694891998a34ed41be0ec8.png',
  29. text: '扫码核验',
  30. paths: '/pagesHouse/Verification/index'
  31. },
  32. {
  33. activeImg: 'https://i.ringzle.com/file/20240106/daf6362d4d6745c29501cf30a4d99bc2.png',
  34. inactiveImg: 'https://i.ringzle.com/file/20240106/8c1f9fc0b5604ef7b966d98f2ffb1d2e.png',
  35. text: '我的',
  36. paths: '/pagesHouse/Mine/index'
  37. }
  38. ]
  39. }
  40. },
  41. mounted() {
  42. this.tabbarValues = this.tabbarid;
  43. },
  44. methods: {
  45. changeTabbars(e) {
  46. console.log(this.list[e].paths, '000');
  47. this.tabbarValues = e;
  48. uni.reLaunch({
  49. url: this.list[e].paths
  50. })
  51. }
  52. }
  53. }
  54. </script>
  55. <style lang="less">
  56. /deep/.u-page__item__slot-icon {
  57. width: 40rpx;
  58. height: 40rpx;
  59. margin: 8rpx 0 4rpx;
  60. }
  61. </style>