| | |
| | | <home :cur="PageCur" v-if="PageCur=='home'" :key="commponent1Key"></home> |
| | | <people v-if="PageCur=='people'" :key="commponent2Key"></people> |
| | | <device v-if="PageCur=='device'" :key="commponent3Key"></device> |
| | | <spare v-if="PageCur=='spare'" :key="commponent4Key"></spare> |
| | | <!-- <spare v-if="PageCur=='spare'" :key="commponent4Key"></spare> --> |
| | | <view class="cu-bar tabbar bg-white shadow foot"> |
| | | <view :class="PageCur=='home'?'action text-green':'action text-gray'" @click="NavChange" data-cur="home"> |
| | | <view class='cuIcon-homefill'></view>首页 |
| | |
| | | <view :class="PageCur=='device'?'action text-green':'action text-gray'" @click="NavChange" data-cur="device"> |
| | | <view class='cuIcon-apps'></view>设备 |
| | | </view> |
| | | <view :class="PageCur=='spare'?'action text-green':'action text-gray'" @click="NavChange" data-cur="spare"> |
| | | <!-- <view :class="PageCur=='spare'?'action text-green':'action text-gray'" @click="NavChange" data-cur="spare"> |
| | | <view class='cuIcon-scan'></view>扫一扫 |
| | | </view> |
| | | </view> --> |
| | | <view :class="PageCur=='people'?'action text-green':'action text-gray'" @click="NavChange" |
| | | data-cur="people"> |
| | | <view class='cuIcon-people'></view>我的 |
| | |
| | | PageCur: 'home', |
| | | commponent1Key: 0, |
| | | commponent2Key: 0, |
| | | commponent3Key: 0, |
| | | commponent4Key: 0 |
| | | commponent3Key: 0 |
| | | |
| | | |
| | | } |
| | | }, |
| | |
| | | ++this.commponent1Key |
| | | ++this.commponent2Key |
| | | ++this.commponent3Key |
| | | ++this.commponent4Key |
| | | }, |
| | | methods: { |
| | | NavChange: function(e) { |
| | | this.PageCur = e.currentTarget.dataset.cur |
| | | NavChange(e) { |
| | | const cur = e.currentTarget.dataset.cur |
| | | // 如果切换到首页,手动更新 cur 值,触发 watch |
| | | if (cur === 'home') { |
| | | // 假设 home 组件已挂载,可通过 ref 调用方法或更新 prop |
| | | this.$refs.home && this.$refs.home.$emit('update:cur', 'home') |
| | | } |
| | | this.PageCur = cur |
| | | } |
| | | |
| | | // NavChange: function(e) { |
| | | // this.PageCur = e.currentTarget.dataset.cur |
| | | // } |
| | | |
| | | } |
| | | } |
| | | </script> |