bottomtab.js
2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
Component({
properties:{
tabidx:{
type:Number,
value:0
}
},
data:{
tabbar:[
{
pagepath:"/pages/me/d_index",
title:"圈子",
isactive:true,
icon:"/pages/image/dog-circle.svg",
iconactive:"/pages/image/dog-circle-active.svg"
},
{
pagepath:"/pages/seller/seller",
title:"服务",
isactive:false,
icon:"/pages/image/dog-server.svg",
iconactive:"/pages/image/dog-server-active.svg"
},
{
pagepath:"",
title:"发布",
icon:"/pages/image/publish.svg"
},
{
pagepath:"/pages/question/question",
title:"科普",
isactive:false,
icon:"/pages/image/answer.svg",
iconactive:"/pages/image/answer-active.svg"
},
{
pagepath:"/pages/person/person",
title:"我的",
isactive:false,
icon:"/pages/image/me.svg",
iconactive:"/pages/image/me-active.svg"
}
],
pubactive:false,
},
attached:function(){
this.autotab();
},
methods:{
tabselect:function (e) {
wx.redirectTo({
url:e.currentTarget.dataset.path
})
},
tabpub:function(){
this.setData({
pubactive:!this.data.pubactive
})
},
autotab:function(){
var tabbar=this.data.tabbar;
var idx=this.data.tabidx;
tabbar.forEach(function(v,i){
v.isactive=false;
if(i==idx){
v.isactive=true;
}
})
this.setData({
tabbar:tabbar
})
},
gopubteam:function(){
this.setData({
pubactive:false,
})
wx.navigateTo({
url:'/pages/pub/p_team'
})
}
}
})