12345678910111213141516171819202122232425262728293031323334353637383940 |
- const app = getApp();
- Component({
- data: {
- selected: 0,
- list: [{
- pagePath: "/pages/index/index",
- "iconPath": "/img/home2.png",
- "selectedIconPath": "/img/home.png",
- text: ""
- }, {
- pagePath: "/pages/my/index",
- "iconPath": "/img/user2.png",
- "selectedIconPath": "/img/user.png",
- text: ""
- }]
- },
- attached() {
- },
- methods: {
- switchTab(e) {
- const data = e.currentTarget.dataset
- const url = data.path;
- if(url === '/pages/my/index' && !app.globalData.userInfo.phone){
- console.log(1111);
- const pages = getCurrentPages();
- const prevPage = pages[pages.length - 1] //获取当前页面信息
- prevPage.setData({
- hideGetInfo:false
- })
- return
- }
- wx.switchTab({url})
- this.setData({
- selected: data.index
- })
- }
- }
- })
|