We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1、『Please using store.method to set method prop of data!』需要如何处理哈
Please using store.method to set method prop of data!
我在组件里,如果没有设置pure:true 会出现这个提示,不知道有什么影响也不知道如何解决哈
pure:true
2、还是不明白 pure:true的区别 我只明白,true的时候,data不会合并
pure:true
true
data
仍可以修改this.store.data.xxx 却不能调用this.store.func(),调用某个store里的函数
this.store.data.xxx
this.store.func()
3、组件里如果在lifetimes 写ready生命周期的处理事件,不能够获取this.store的值 但是如果把ready拿到外面写就可以获取this.store
lifetimes
ready
this.store
4、有一个很神奇的情况 页面获取数据,然后赋值 this.store.data["goodsList"] = []; 然后跳转到别的页面,在后退的时候,出现
this.store.data["goodsList"] = [];
但是如果使用setData就不会有这样情况
setData
这个情况,我发现复习场景是
页面A(有赋值data)=> redirectTo到页面B => redirectTo到页面A => 报错
但是如果是
页面A(有赋值data)=> navigateTo到页面B => redirectTo到页面A
就没问题
The text was updated successfully, but these errors were encountered:
不能直接改data的方法,需要使用store.method传入path和方法改
纯组件的store和全局的store不是同一个
3是正常现象
4没看懂
Sorry, something went wrong.
不好意思 周末回复晚了 1、这是我的store文件
export default { data: { user_info: {}, user_coin: function() { return this["user_info"]["coin"] || 0; } }, globalData: [ "user_info", "user_coin", ], /** * @name 打开授权弹层 */ authPopOpen: function() { this.data.auth_pop["enable"] = true; }, /** * @name 获取用户新手教程状态 */ getUserStep: async function() { let _step = 0; !this.data["user_info_loaded"] && (await getUserInfo()); _step = this.data["user_info"]["step"]; return Promise.resolve(_step); }
请问authPopOpen,getUserStep是属于store.method吗
authPopOpen
getUserStep
2、明白了,就是这里store是组件内,不影响其他组件 3、请问这个为什么里面要不一样哈 4、这个我找时间上传代码看看哈
authPopOpen 和 getUserStep 不属于,user_coin 属于
No branches or pull requests
1、『
Please using store.method to set method prop of data!
』需要如何处理哈我在组件里,如果没有设置
pure:true
会出现这个提示,不知道有什么影响也不知道如何解决哈2、还是不明白
pure:true
的区别我只明白,
true
的时候,data
不会合并仍可以修改
this.store.data.xxx
却不能调用
this.store.func()
,调用某个store里的函数3、组件里如果在
lifetimes
写ready
生命周期的处理事件,不能够获取this.store
的值但是如果把
ready
拿到外面写就可以获取this.store
4、有一个很神奇的情况
![image](https://user-images.githubusercontent.com/5879146/47228299-7352f700-d3f7-11e8-99b9-c5dbe1ace7a8.png)
页面获取数据,然后赋值
this.store.data["goodsList"] = [];
然后跳转到别的页面,在后退的时候,出现
但是如果使用
setData
就不会有这样情况Update
这个情况,我发现复习场景是
但是如果是
就没问题
The text was updated successfully, but these errors were encountered: