change tab-bar logic
parent
db11f03bda
commit
239d4f0c7c
|
|
@ -10,17 +10,13 @@ const navList: () => Array<Taro.TabBarItem> = () => {
|
||||||
return wechatUser.getAccess()
|
return wechatUser.getAccess()
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
pagePath: '/pages/index/index',
|
pagePath: '/pages/member/member',
|
||||||
text: pt.get().tabBar.indexText,
|
text: pt.get().tabBar.memberText,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pagePath: '/pages/repair/repair',
|
pagePath: '/pages/repair/repair',
|
||||||
text: pt.get().tabBar.repairText,
|
text: pt.get().tabBar.repairText,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
pagePath: '/pages/member/member',
|
|
||||||
text: pt.get().tabBar.memberText,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
pagePath: '/pages/user/user',
|
pagePath: '/pages/user/user',
|
||||||
text: pt.get().tabBar.userText,
|
text: pt.get().tabBar.userText,
|
||||||
|
|
@ -46,17 +42,13 @@ const tabList = () => {
|
||||||
return wechatUser.getAccess()
|
return wechatUser.getAccess()
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
title: pt.get().tabBar.indexText,
|
title: pt.get().tabBar.memberText,
|
||||||
iconType: 'home',
|
iconType: 'sketch',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: pt.get().tabBar.repairText,
|
title: pt.get().tabBar.repairText,
|
||||||
iconType: 'settings',
|
iconType: 'settings',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: pt.get().tabBar.memberText,
|
|
||||||
iconType: 'sketch',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: pt.get().tabBar.userText,
|
title: pt.get().tabBar.userText,
|
||||||
iconType: 'user',
|
iconType: 'user',
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ export default class MemberPage extends Component<{}, MemberPageState> {
|
||||||
pageCtx = Taro.getCurrentInstance().page;
|
pageCtx = Taro.getCurrentInstance().page;
|
||||||
componentDidShow() {
|
componentDidShow() {
|
||||||
const tabbar = Taro.getTabBar<CustomTabBar>(this.pageCtx);
|
const tabbar = Taro.getTabBar<CustomTabBar>(this.pageCtx);
|
||||||
tabbar?.setSelected(2);
|
tabbar?.setSelected(0);
|
||||||
}
|
}
|
||||||
// 以上是TabBar相关
|
// 以上是TabBar相关
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ export default class UserPage extends Component {
|
||||||
pageCtx = Taro.getCurrentInstance().page;
|
pageCtx = Taro.getCurrentInstance().page;
|
||||||
componentDidShow() {
|
componentDidShow() {
|
||||||
const tabbar = Taro.getTabBar<CustomTabBar>(this.pageCtx);
|
const tabbar = Taro.getTabBar<CustomTabBar>(this.pageCtx);
|
||||||
tabbar?.setSelected(wechatUser.getAccess() ? 3 : 2);
|
tabbar?.setSelected(2);
|
||||||
}
|
}
|
||||||
// 以上是TabBar相关
|
// 以上是TabBar相关
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue