Initial commit
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
Component({
|
||||
data: {
|
||||
selected: 0,
|
||||
color: "#B8BBC3",
|
||||
selectedColor: "#312D22",
|
||||
key: 'tabbar_key',
|
||||
list: [
|
||||
{
|
||||
pagePath: "/pages/index/index",
|
||||
iconPath: "/static/images/home2.png",
|
||||
selectedIconPath: "/static/images/home.png",
|
||||
text: "首页"
|
||||
},
|
||||
{
|
||||
pagePath: "/pages/user/index",
|
||||
iconPath: "/static/images/user2.png",
|
||||
selectedIconPath: "/static/images/user.png",
|
||||
text: "用户"
|
||||
}
|
||||
]
|
||||
},
|
||||
moved(){
|
||||
console.log('moved')
|
||||
},
|
||||
attached() {
|
||||
console.log( '123attachedattachedattached123')
|
||||
// wx.eventBus.on({
|
||||
// key: this.key,
|
||||
// event: 'change',
|
||||
// listener: () => {
|
||||
try {
|
||||
let value = wx.getStorageSync('store_userinfo').role
|
||||
console.log(value,`wx.getStorageSync('store_userinfo').role`)
|
||||
if (value == 1) {
|
||||
this.setData({
|
||||
list: [{
|
||||
pagePath: "/pages/carepage/index",
|
||||
iconPath: "/static/images/Group2.png",
|
||||
selectedIconPath: "/static/images/Group.png",
|
||||
text: "护理"
|
||||
}]
|
||||
})
|
||||
}else if(value == 0){
|
||||
this.setData({
|
||||
list: [{
|
||||
pagePath: "/pages/index/index",
|
||||
iconPath: "/static/images/home2.png",
|
||||
selectedIconPath: "/static/images/home.png",
|
||||
text: "首页"
|
||||
},
|
||||
{
|
||||
pagePath: "/pages/user/index",
|
||||
iconPath: "/static/images/user2.png",
|
||||
selectedIconPath: "/static/images/user.png",
|
||||
text: "用户"
|
||||
}]
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
// Do something when catch error
|
||||
}
|
||||
// }
|
||||
// })
|
||||
|
||||
|
||||
// 可以在这里控制显示
|
||||
},
|
||||
methods: {
|
||||
switchTab(e) {
|
||||
const data = e.currentTarget.dataset
|
||||
const url = data.path
|
||||
// console.log(url)
|
||||
wx.switchTab({ url })
|
||||
this.setData({
|
||||
selected: data.index
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user