index.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <view class="main-content">
  3. <view>
  4. <indexBox v-if=" pageAction == 'index' " />
  5. <meBox v-if=" pageAction == 'me' " />
  6. </view>
  7. <view class="main-tabar">
  8. <view class="main-tabar-info">
  9. <view class="main-tabar-item" @click="clickTabbar('index')">
  10. <view>
  11. <image :src="staticUrl+'/img/tabbar-home.png'"></image>
  12. </view>
  13. <text>{{ '首页' }}</text>
  14. </view>
  15. <view class="main-tabar-item">
  16. <view>
  17. <image :src="staticUrl+'/img/tabbar-my.png'" @click="clickTabbar('me')"></image>
  18. </view>
  19. <text>{{ '我的' }}</text>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import indexBox from "../index/index.vue"
  27. import meBox from "../me/index.vue"
  28. export default {
  29. components: {
  30. indexBox,
  31. meBox
  32. },
  33. data() {
  34. return {
  35. title: '主页',
  36. pageAction: 'index',
  37. staticUrl:'https://miniores.hw.hongweisoft.com/greattransition/staticfile',
  38. }
  39. },
  40. onLoad() {
  41. },
  42. onShow() {
  43. this.pageAction = uni.getStorageSync('page_action') || 'index'
  44. console.log('this.pageAction===',uni.getStorageSync('page_action'),this.pageAction)
  45. },
  46. methods: {
  47. /**
  48. * @author ygh
  49. * @data 2023-12-19
  50. * @param {Object} type
  51. */
  52. clickTabbar(type){
  53. this.pageAction = type
  54. uni.setStorageSync('page_action',this.pageAction)
  55. }
  56. }
  57. }
  58. </script>
  59. <style lang="scss" scoped>
  60. .main-content {
  61. width: 100%;
  62. height: 100%;
  63. position: relative;
  64. }
  65. /** tabar */
  66. .main-tabar {
  67. width: 80vw;
  68. height: 100rpx;
  69. position: fixed;
  70. bottom: 20rpx;
  71. left: 50%;
  72. transform: translateX(-50%);
  73. box-sizing: border-box;
  74. .main-tabar-info {
  75. width: 100%;
  76. height: 100%;
  77. display: flex;
  78. justify-content: space-between;
  79. box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 6px 0px;
  80. border-radius: 40rpx;
  81. .main-tabar-item {
  82. flex: 1;
  83. display: flex;
  84. align-items: center;
  85. flex-direction: column;
  86. justify-content: center;
  87. image {
  88. width: 50rpx;
  89. height: 50rpx;
  90. }
  91. text {
  92. font-size: 24rpx;
  93. }
  94. }
  95. }
  96. }
  97. </style>