Commit f2b83d8e authored by mengcuiguang's avatar mengcuiguang

代码优化

parent fd7181ce
...@@ -83,23 +83,23 @@ ...@@ -83,23 +83,23 @@
} }
}, },
onShow() { onShow() {
if (app.globalData.resetLogin && !this.isFirstLoad) { // if (app.globalData.resetLogin && !this.isFirstLoad) {
// this.wxLogin() // // this.wxLogin()
} // }
this.isFirstLoad = false // this.isFirstLoad = false
try { // try {
// 在子组件重写show()代替onShow() // // 在子组件重写show()代替onShow()
if (this.currentPage == 0) { // if (this.currentPage == 0) {
this.$refs.index.show(); // this.$refs.index.show();
} else if (this.currentPage == 1) { // } else if (this.currentPage == 1) {
this.$refs.recommend.show(); // this.$refs.recommend.show();
} else if (this.currentPage == 2) { // } else if (this.currentPage == 2) {
this.$refs.user.show(); // this.$refs.user.show();
} // }
} catch (e) { // } catch (e) {
} // }
}, },
mounted() { mounted() {
// 渲染完成 初始化首页数据 // 渲染完成 初始化首页数据
...@@ -118,11 +118,15 @@ ...@@ -118,11 +118,15 @@
loadComponentData() { loadComponentData() {
if (this.currentPage == 0) { if (this.currentPage == 0) {
this.$refs.index.show(); this.$refs.index.show();
this.$refs.recommend.hide(); this.$refs.recommend.hide();
this.$refs.user.hide();
} else if (this.currentPage == 1) { } else if (this.currentPage == 1) {
this.$refs.recommend.show(); this.$refs.recommend.show();
this.$refs.index.hide();
this.$refs.user.hide();
} else if (this.currentPage == 2) { } else if (this.currentPage == 2) {
this.$refs.user.show(); this.$refs.user.show();
this.$refs.index.hide();
this.$refs.recommend.hide(); this.$refs.recommend.hide();
} }
}, },
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment