You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.3 KiB
57 lines
1.3 KiB
4 months ago
|
// 引入全局函数
|
||
|
const app = getApp()
|
||
|
Component({
|
||
|
/**
|
||
|
* 组件的初始数据
|
||
|
*/
|
||
|
data: {
|
||
|
selected: 0,
|
||
|
color: "#333333",
|
||
|
selectedColor: "#08B3B3",
|
||
|
backgroundColor: "#ffffff",
|
||
|
list: [
|
||
|
{
|
||
|
pagePath: "/pages/index/index",
|
||
|
iconPath: "/images/icon/home.png",
|
||
|
selectedIconPath: "/images/icon/home-a.png",
|
||
|
text: "首页",
|
||
|
},
|
||
|
{
|
||
|
pagePath: "/pages/message/message",
|
||
|
iconPath: "/images/icon/message.png",
|
||
|
selectedIconPath: "/images/icon/message-a.png",
|
||
|
text: "消息",
|
||
|
},
|
||
|
{
|
||
|
pagePath: "/pages/life/life",
|
||
|
iconPath: "/images/icon/life.png",
|
||
|
selectedIconPath: "/images/icon/life-a.png",
|
||
|
text: "生活圈"
|
||
|
},
|
||
|
{
|
||
|
pagePath: "/pages/mine/mine",
|
||
|
iconPath: "/images/icon/mine.png",
|
||
|
selectedIconPath: "/images/icon/mine-a.png",
|
||
|
text: "我的"
|
||
|
},
|
||
|
]
|
||
|
},
|
||
|
ready: function() {
|
||
|
this.setData({
|
||
|
selected: app.globalData.selected
|
||
|
})
|
||
|
},
|
||
|
/**
|
||
|
* 组件的方法列表
|
||
|
*/
|
||
|
methods: {
|
||
|
switchTab(e) {
|
||
|
// console.log(e);
|
||
|
const data = e.currentTarget.dataset;
|
||
|
const url = data.path;
|
||
|
app.globalData.selected = data.index;
|
||
|
wx.switchTab({url})
|
||
|
}
|
||
|
}
|
||
|
})
|