//首页 <template> <view class="index"> <TabBar></TabBar> <view v-for="item in menu" :key="item.id" class="menu-item" @click="handleClick(item.id)" >{{item.name}}</view> </view> </template> <script> import { mapMutations } from 'vuex'; import TabBar from '@/components/tabBar/tabBar.vue'; import { getLogin } from '@/utils/auth.js'; export default { components: { TabBar, }, data() { return { currentPagePath: '', menu: [ { id: 'submit', name: '访客信息提交' }, { id: 'check', name: '物联设备状态查看' }, ] } }, onLoad() { // console.log('88888888'); // console.log(this.$route); // console.log('88888888'); // this.currentPagePath = this.$route.meta.pagePath; getLogin(); }, onShow() { let pages = getCurrentPages(); const curPage = pages[pages.length - 1]; this.currentPagePath = curPage.route; uni.setStorageSync('currentPagePath', this.currentPagePath); }, methods: { // ...mapMutations(['setNavRect']) handleClick(id) { console.log('跳转') wx.navigateTo({ url: `/pages/mine/mine`, }); } } } </script> <style lang="scss" scoped> .index { display: flex; justify-content: space-around; .menu-item { width: 200rpx; height: 200rpx; color: #000; background-color: #fff; border: 1px solid gray; } } </style>