index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <view class="page">
  3. <u-tabbar :value="tabbarValue" @change="name => tabbarValue = name" :fixed="true" :placeholder="true"
  4. :safeAreaInsetBottom="true" :border="false" style="z-index: 99999 !important;">
  5. <u-tabbar-item style="z-index: 99999 !important;" :text="item.text" v-for="(item,index) in list"
  6. :key="index" @click="changeTabbar">
  7. <image class="u-page__item__slot-icon" slot="active-icon" :src="item.activeImg"></image>
  8. <image class="u-page__item__slot-icon" slot="inactive-icon" :src="item.inactiveImg"></image>
  9. </u-tabbar-item>
  10. </u-tabbar>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. props: {
  16. tabbarIndex: 0
  17. },
  18. data() {
  19. return {
  20. tabbarValue: 0,
  21. list: [{
  22. activeImg: 'https://i.ringzle.com/file/20240106/57895bbc5414416ea5de2a537ed23dc3.png',
  23. inactiveImg: 'https://i.ringzle.com/file/20240106/29bd09ef7eb748f1820c335f86f74c61.png',
  24. text: '首页',
  25. path: '/pages/home/index'
  26. },
  27. {
  28. activeImg: 'https://i.ringzle.com/file/20240106/584d0a4108c44fa5bc566d0d0082e07d.png',
  29. inactiveImg: 'https://i.ringzle.com/file/20240106/9561cd3843694891998a34ed41be0ec8.png',
  30. text: '房态',
  31. path: '/pages/house/index'
  32. },
  33. {
  34. activeImg: 'https://i.ringzle.com/file/20240106/41a218ecacd543b28faf20760712c372.png',
  35. inactiveImg: 'https://i.ringzle.com/file/20240106/9873e71314e44c22aa880bec2ecdac85.png',
  36. text: '统计',
  37. path: '/pages/statistics/index'
  38. },
  39. {
  40. activeImg: 'https://i.ringzle.com/file/20240106/daf6362d4d6745c29501cf30a4d99bc2.png',
  41. inactiveImg: 'https://i.ringzle.com/file/20240106/8c1f9fc0b5604ef7b966d98f2ffb1d2e.png',
  42. text: '我的',
  43. path: '/pages/my/index'
  44. }
  45. ]
  46. }
  47. },
  48. mounted() {
  49. this.tabbarValue = this.tabbarIndex;
  50. },
  51. methods: {
  52. changeTabbar(e) {
  53. this.tabbarValue = e;
  54. uni.reLaunch({
  55. url: this.list[e].path
  56. })
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="less">
  62. /deep/.u-page__item__slot-icon {
  63. width: 40rpx;
  64. height: 40rpx;
  65. margin: 8rpx 0 4rpx;
  66. }
  67. </style>
  68. <style lang="scss">
  69. .page {
  70. position: relative;
  71. z-index: 99999;
  72. }
  73. .u-tabbar__content {
  74. z-index: 99999 !important;
  75. }
  76. .u-tabbar__content__item-wrapper {
  77. z-index: 99999 !important;
  78. }
  79. </style>