nav.js
1.41 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
// components/nav/nav.js
Component({
/**
* 组件的属性列表
*/
properties: {
backgroundColor:{
type:String,
value:'#ffffff'
},
color:{
type:String,
value:'#000000'
},
hasHome:{
type:Boolean,
value:false
}
},
/**
* 组件的初始数据
*/
data: {
disHome:false,
disBack:false,
},
attached(){
let disBack = false;
let disHome = false;
let pages = getCurrentPages();
console.log('pages.length',pages[0]);
if (pages.length > 1) {
disBack = true;
} else {
//if (getApp().shareTicket && this.data.hasHome) {
if (this.data.hasHome && pages[0].route!="pages/customer/list") {
disHome = true;
}
}
let wxBarHeight=68;
let statusBarHeight=getApp().system.statusBarHeight*getApp().system.pixelRatio;
this.setData({
statusBarHeight: statusBarHeight,
disHome: disHome,
disBack: disBack,
statusBarHeightFull:wxBarHeight + statusBarHeight,
})
console.log('this.setData',this.data);
},
/**
* 组件的方法列表
*/
methods: {
back(){
wx.navigateBack()
},
home(){
if(!this.data.disHome) return;
wx.reLaunch({
url:'/pages/customer/index'
})
}
}
})