dingdong-master/pages/index/index.vue

70 lines
1.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view>
<index v-if="curPageCode === 'indexPage'"></index>
<goods-manage v-else-if="curPageCode === 'supplyChainPage'"></goods-manage>
<my-home v-else-if="curPageCode === 'myPage'"></my-home>
<msg-home v-else-if="curPageCode === 'msgPage'"></msg-home>
<module-bar :moduleBarInfos="moduleBarInfos"></module-bar>
</view>
</template>
<script>
import moduleBar from '@/components/custom-bar/module-bar.vue';
import index from '@/pages/index/index-home.vue';
import myHome from '@/pages/index/my-home.vue';
import msgHome from '@/pages/index/msg-home.vue';
import goodsManage from '@/pages/index/goods-manage.vue';
export default {
components: {
moduleBar,
index,
myHome,
msgHome,
goodsManage
},
data() {
return {
moduleBarInfos: [],
curPageCode: 'indexPage'
}
},
onLoad() {
this.loadData();
this.bindEvent();
},
onUnload() {
this.offEvent();
},
methods: {
async loadData() {
// uni.getSystemInfo({
// success: function(res) {
// console.log('DPR' + res.pixelRatio)
// console.log('宽度:' + res.screenWidth)
// console.log('高度:' + res.screenHeight)
// }
// })
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>