Commit d08f9d2d authored by jyx's avatar jyx

代码优化

parent a7841521
...@@ -117,13 +117,13 @@ ...@@ -117,13 +117,13 @@
let index = options.index ?? '' let index = options.index ?? ''
if (index != '' && index != undefined) { if (index != '' && index != undefined) {
this.currentPage = index this.currentPage = index
} }
// #ifdef MP-TOUTIAO // #ifdef MP-TOUTIAO
tt.setNavigationBarColor({ tt.setNavigationBarColor({
frontColor: '#000000', frontColor: '#000000',
backgroundColor: '#ffffff' backgroundColor: '#ffffff'
}) })
// #endif // #endif
if (wx.setVisualEffectOnCapture) { if (wx.setVisualEffectOnCapture) {
...@@ -133,17 +133,16 @@ ...@@ -133,17 +133,16 @@
}, },
}) })
} }
}, },
onShow() { onShow() {
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();
} }
...@@ -151,6 +150,20 @@ ...@@ -151,6 +150,20 @@
} }
}, },
onHide() {
try {
// 在子组件重写show()代替onShow()
if (this.currentPage == 0) {
this.$refs.index.hide();
} else if (this.currentPage == 1) {
this.$refs.recommend.hide();
} else if (this.currentPage == 2) {
this.$refs.user.hide();
}
} catch (e) {
}
},
mounted() { mounted() {
// 渲染完成 初始化首页数据 // 渲染完成 初始化首页数据
this.loadComponentData(); this.loadComponentData();
...@@ -180,22 +193,22 @@ ...@@ -180,22 +193,22 @@
} }
}, },
changeBottomBarColor(b) { changeBottomBarColor(b) {
this.isShowBlackBar = b this.isShowBlackBar = b
// #ifdef MP-TOUTIAO // #ifdef MP-TOUTIAO
if(b){ if (b) {
tt.setNavigationBarColor({ tt.setNavigationBarColor({
frontColor: '#ffffff', frontColor: '#ffffff',
backgroundColor: '#000000' backgroundColor: '#000000'
}) })
}else{ } else {
tt.setNavigationBarColor({ tt.setNavigationBarColor({
frontColor: '#000000', frontColor: '#000000',
backgroundColor: '#ffffff' backgroundColor: '#ffffff'
}) })
} }
// #endif // #endif
}, },
showEditBarH(b) { showEditBarH(b) {
this.showEditBar = b this.showEditBar = b
...@@ -218,7 +231,7 @@ ...@@ -218,7 +231,7 @@
<style lang="scss"> <style lang="scss">
.body { .body {
height: 100%; height: 100%;
background-color: #f5f5f5; background-color: #f5f5f5;
} }
......
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