dingdong-master/pages/index/index.vue

70 lines
1.7 KiB
Vue
Raw Normal View History

2022-04-29 17:23:40 +08:00
<template>
<view>
2022-05-24 18:03:36 +08:00
<index v-if="curPageCode === 'indexPage'"></index>
<goods-manage v-else-if="curPageCode === 'supplyChainPage'"></goods-manage>
<my-home v-else-if="curPageCode === 'myPage'"></my-home>
2022-05-21 23:49:53 +08:00
<msg-home v-else-if="curPageCode === 'msgPage'"></msg-home>
<module-bar :moduleBarInfos="moduleBarInfos"></module-bar>
2022-04-29 17:23:40 +08:00
</view>
</template>
<script>
import moduleBar from '@/components/custom-bar/module-bar.vue';
2022-05-24 18:03:36 +08:00
import index from '@/pages/index/index-home.vue';
import myHome from '@/pages/index/my-home.vue';
2022-05-21 23:49:53 +08:00
import msgHome from '@/pages/index/msg-home.vue';
2022-05-24 18:03:36 +08:00
import goodsManage from '@/pages/index/goods-manage.vue';
2022-04-29 17:23:40 +08:00
export default {
components: {
moduleBar,
2022-05-24 18:03:36 +08:00
index,
myHome,
msgHome,
goodsManage
2022-04-29 17:23:40 +08:00
},
data() {
return {
moduleBarInfos: [],
curPageCode: 'indexPage'
2022-04-29 17:23:40 +08:00
}
},
onLoad() {
this.loadData();
this.bindEvent();
},
onUnload() {
this.offEvent();
},
methods: {
async loadData() {
2022-05-24 18:03:36 +08:00
// uni.getSystemInfo({
// success: function(res) {
// console.log('DPR' + res.pixelRatio)
// console.log('宽度:' + res.screenWidth)
// console.log('高度:' + res.screenHeight)
// }
// })
2022-04-29 17:23:40 +08:00
this.moduleBarInfos = await this.$api.data('moduleBarInfos');
},
bindEvent() {
uni.$on('getCurPageInfo', function(data) {
if (data.curPageCode === 'publishPage') {
this.isShowPublish = true;
} else {
this.isShowPublish = false;
this.curPageCode = data.curPageCode;
}
}.bind(this));
},
offEvent() {
uni.$off('getCurPageInfo')
}
}
}
</script>
<style scoped>
</style>