forked from hahaha666666/westroe-globalData
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstore.js
31 lines (31 loc) · 932 Bytes
/
store.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
export default {
data: {
motto: 'Hello World',
userInfo: {},
hasUserInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo'),
logs: [],
b: {
arr: [{ name: '数值项目1' }] ,
//深层节点也支持函数属性
fnTest:function(){
return this.motto.split('').reverse().join('')
}
},
firstName: 'dnt',
lastName: 'zhang',
fullName: function () {
return this.firstName + this.lastName
},
pureProp: 'pureProp',
globalPropTest: 'abc', //更改我会刷新所有页面,不需要再组件和页面声明data依赖
ccc: { ddd: 1 } //更改我会刷新所有页面,不需要再组件和页面声明data依赖
},
globalData: ['globalPropTest', 'ccc.ddd'],
logMotto: function () {
console.log(this.data.motto)
},
bbb:'这是初始全局变量bbb'
//默认 false,为 true 会无脑更新所有实例
//updateAll: true
}