Commit 7560f9df by 程默

fix tabbar

parent add36e11
...@@ -2,6 +2,17 @@ const app = getApp() ...@@ -2,6 +2,17 @@ const app = getApp()
console.log(app, 'apppppppppp') console.log(app, 'apppppppppp')
Component({ Component({
pageLifetimes: {
show() {
console.log('哈哈哈哈')
if (typeof this.getTabBar === 'function' &&
this.getTabBar()) {
this.getTabBar().setData({
selected: 1
})
}
}
},
data: { data: {
selected: 0, selected: 0,
color: "#7A7E83", color: "#7A7E83",
...@@ -65,7 +76,9 @@ Component({ ...@@ -65,7 +76,9 @@ Component({
} }
// ----------webview 变化 // ----------webview 变化
console.log('启动1111') console.log('启动1111',this.getTabBar())
app.webviewCallBack = function (state,params) { app.webviewCallBack = function (state,params) {
console.log('webview变化',state,params) console.log('webview变化',state,params)
} }
...@@ -75,27 +88,22 @@ Component({ ...@@ -75,27 +88,22 @@ Component({
}, },
switchTab(e) { switchTab(e) {
// mpApp.$themeToLink //
const { const {
index index
} = e.currentTarget.dataset } = e.currentTarget.dataset
console.log('755555555', this.data.list[index].link) console.log('755555555', this.data.list[index].link)
// if (index == this.data.selected) return
app.globalData.tabBarPageLink=this.data.list[index].link.link app.$themeToLink(this.data.list[index]['link'],1)
console.log(app,'aaaa') // this.toPage(this.data.list[index].link,index)
this.toPage(this.data.list[index].link,index) // this.setData({
// selected: index
// return // })
// app.$themeToLink(this.data.list[index].link)
// this.setData({
// selected: index
// })
}, },
toPage(data,index){ toPage(data,index){
console.log('index98',index) console.log('index98',index,this)
// index=index==0?index+1:index
// 跳转 // 跳转
if (data.link=='/') { if (data.link=='/') {
wx.switchTab({ wx.switchTab({
......
<!--miniprogram/custom-tab-bar/index.wxml--> <!--miniprogram/custom-tab-bar/index.wxml-->
<cover-view class="tab-bar"> <cover-view class="tab-bar">
<cover-view class="antt ant-daipinglun"></cover-view>
<cover-view class="iconfont icon-fenzhi">3</cover-view>
<cover-view class="tab-bar-border"></cover-view> <cover-view class="tab-bar-border"></cover-view>
<cover-view wx:for="{{list}}" wx:key="index" class="tab-bar-item" data-path="{{item.link}}" data-index="{{index}}" <cover-view wx:for="{{list}}" wx:key="index" class="tab-bar-item" data-path="{{item.link}}" data-index="{{index}}"
bindtap="switchTab"> bindtap="switchTab">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment