-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathapp.js
49 lines (47 loc) · 931 Bytes
/
app.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
//app.js
App({
systemInfo: null,
dbTodos: null,
dbFeedback: null,
onLaunch(options) {
const self = this;
//初始化云函数
wx.cloud.init({
env: 'todolist-eea649',
// env: 'todolist-test-80be87',
traceUser: 'true'
});
wx.getSystemInfo({
success(res) {
self.systemInfo = res;
}
});
//初始化DB
let db = wx.cloud.database({
env: 'todolist-eea649'
// env: 'todolist-test-80be87'
});
//获取todos
self.dbTodos = db.collection('todos');
//获取feedback
self.dbFeedback = db.collection('feedback');
},
onShow(options) {
console.log("onShow");
},
onHide() {
console.log("onHide");
},
onError(error) {
console.log("onError");
},
onPageNotFound(options) {
console.log("onPageNotFound");
},
globalData: {
userInfo: null,
openid: null,
id: null,
needRefresh: false
}
});