Files
AGuestSaas/components/storeTabBar/storeTabBar.js
2020-12-30 10:15:22 +08:00

56 lines
1.1 KiB
JavaScript

/**
* Web唐明明
* 匆匆数载恍如梦,岁月迢迢华发增。
* 碌碌无为枉半生,一朝惊醒万事空。
*/
import { tabBar } from "../../lib/storeConfig"
Component({
/**
* 组件接收参数
*/
properties: {
// 显示组件页面的路径
pagesUrl : {
type : String,
value : ""
}
},
/**
* 组件的初始数据
*/
data: {
selected : 0,
color : "#4e4f51",
selectedColor : "#0b0041",
list : []
},
/**
* 生命周期函数
*/
pageLifetimes: {
show(){
let selectedIndex = tabBar.findIndex(val=> val.pagePath == '/' + this.data.pagesUrl)
this.setData({
list : tabBar,
selected: selectedIndex
})
}
},
/**
* 组件的方法列表
*/
methods: {
switchTab(e) {
const data = e.currentTarget.dataset
const url = data.path
wx.reLaunch({
url
})
}
}
})