-
Notifications
You must be signed in to change notification settings - Fork 140
/
Copy pathindex.js
49 lines (48 loc) · 1.19 KB
/
index.js
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
//index.js
//获取应用实例
//const app = getApp();
Page({
data: { background: 'rgba(255,255,255,1)' },
handlerGobackClick() {
wx.showModal({
title: '你点击了返回',
content: '是否确认放回',
success: e => {
if (e.confirm) {
const pages = getCurrentPages();
if (pages.length >= 2) {
wx.navigateBack({
delta: 1
});
} else {
wx.navigateTo({
url: '/pages/index/index'
});
}
}
}
});
},
onReady: function() {
// 页面首次渲染完毕时执行
let $navBar = this.selectComponent("#navBar")
console.log(this.selectComponent("#navBar"))
let navBarHeight = $navBar.data.navBarExtendHeight + $navBar.data.navBarHeight
console.log('navBarHeight', navBarHeight);
},
onPageScroll(e) {
let opciaty = e.scrollTop / 130;
if (opciaty >= 1) {
opciaty = 1;
} else if (opciaty <= 0) {
opciaty = 0;
}
console.log('opciaty', opciaty);
this.setData({ background: `rgba(255,0,0,${opciaty})` });
},
handlerGohomeClick() {
wx.navigateTo({
url: '/pages/index/index'
});
}
});