From 02e5ef56dbaae7caedf0a0e52ff9711d5f022656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=93=E5=B9=B3=E8=89=BA?= <52643018@qq.com> Date: Wed, 13 Oct 2021 15:36:35 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=8A=A8=E6=80=81=E9=9A=90=E8=97=8Ftabbar?= =?UTF-8?q?=E5=AF=BC=E8=88=AA=202.=E4=BC=98=E5=8C=96nav=E5=AF=BC=E8=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/index-nav/index-nav.less | 8 ++++++-- components/lf-tabbar/lf-tabbar.vue | 10 ++++++++-- pages/index/index/index.vue | 3 +++ store/index.js | 17 +++++++++++++---- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/components/index-nav/index-nav.less b/components/index-nav/index-nav.less index e9fd21f..c00f580 100644 --- a/components/index-nav/index-nav.less +++ b/components/index-nav/index-nav.less @@ -7,11 +7,15 @@ flex-wrap:wrap; padding: 10px 0 0 0; // width: 890rpx; - width: 1000rpx; + // width: 1000rpx; + + width: 1100rpx; .nav-item{ padding:0px 0px 10px 0px; // width: 25%; - width: 13.8%; + // width: 13.8%; + width: 12.5%; + // width: 68.97px; // height: 73px; text-align: center; diff --git a/components/lf-tabbar/lf-tabbar.vue b/components/lf-tabbar/lf-tabbar.vue index 7e2138d..adf1b78 100644 --- a/components/lf-tabbar/lf-tabbar.vue +++ b/components/lf-tabbar/lf-tabbar.vue @@ -5,8 +5,9 @@ @@ -29,7 +30,7 @@ }, data(){ return { - + show_count: 0 } }, computed: { @@ -42,11 +43,16 @@ let tabbars = this.tabbars; let tabbar_name = tabbars[this.currentTabBar].path; let current = 0; + let show_count = 0; tabbars.map((item, index) => { if(item.path == '/'+ page){ current = index; } + if(item.show){ + show_count++; + } }) + this.show_count = show_count; if(tabbar_name != '/'+ page){ this.$store.commit('setCurrentTabBar', current); } diff --git a/pages/index/index/index.vue b/pages/index/index/index.vue index b3a5881..8ba6ff7 100644 --- a/pages/index/index/index.vue +++ b/pages/index/index/index.vue @@ -385,6 +385,9 @@ this.microData = ''; this.microData = res.data; this.is_show_init = true; + let show_discover = this.$isRight(res.data.discover_status); + this.$store.commit('setTabbarItemShow', {index: 2, is_show: show_discover}); + if (res.data && res.data.micro_page) { wx.setNavigationBarTitle({ title: res.data.micro_page.name diff --git a/store/index.js b/store/index.js index 6a3e82b..f1942e7 100644 --- a/store/index.js +++ b/store/index.js @@ -9,25 +9,29 @@ let state = { name: 'home', text: '首页', icon: 'icon-xianxingicon-03', - path: '/pages/index/index/index' + path: '/pages/index/index/index', + show: true }, { name: 'brand', text: '品牌', icon: 'icon-pinpailiebiao', - path: '/pages/index/category/category' + path: '/pages/index/category/category', + show: true }, { name: 'find', text: '发现', icon: 'icon-faxian', - path: '/pages/discover/discover' + path: '/pages/discover/discover', + show: true }, { name: 'my', text: '会员中心', icon: 'icon-icon', - path: '/pages/user/my/center' + path: '/pages/user/my/center', + show: true } ], isShowTabBar: true @@ -45,6 +49,11 @@ let mutations = { // 隐藏tabbar hideTabBar(state, data){ state.isShowTabBar = false; + }, + // 设置某个tabbar项显示隐藏 + setTabbarItemShow(state, data){ + let { index, is_show } = data; + state.tabbars[index].show = is_show; } }