Comments (11)
@githublyp 可以具体描述下问题是什么吗?然后你可以跟另外你提的问题,一并再看下,不知道那个问题跟你这个问题是否有一定关联性
from okam.
watch调用两次
watch: {
userInfo: {
handler() {
// 当用户登录完后请求业务逻辑
this.userInfo.uid && this.getUserInfo()
},
deep: true
}
},
from okam.
@githublyp 没太懂,你这里描述跟标题描述 computed 和 watch 使用冲突有什么直接关系吗?可以具体点描述下你的现象和问题吗?还有 watch 调用两次,具体是做了什么事情触发了两次了?
from okam.
computed 和 watch 使用冲突,这个是由于computed未重新计算引起的,已经好了;
就是我在watch内:
from okam.
@githublyp userInfo 什么时候设置的,具体怎么设置修改的?是你在外部发起异步请求,更新 store userInfo,然后 watch 这里 handler 触发了两次?然后还有个问题,为啥watch handler 里要手动触发生命周期钩子,这个钩子方法是不应该开发者自己去触发调用的
from okam.
userInfo 在外部发起异步请求,更新 store userInfo,然后 watch 这里 handler 触发了两次;
from okam.
userInfo 在外部发起异步请求,更新 store userInfo,然后 watch 这里 handler 触发了两次;
我这边看下能不能复现你的问题
from okam.
@githublyp 我这边还是不能复现你说的问题,如果方便的话,可以给下能复现你这个问题的代码示例,谢谢~
from okam.
这是reducer:
异步更新了:
SET_STATE_STATUS
SET_STATE_USERINFO
不知道是不是redux的问题
from okam.
这是reducer:
异步更新了:
SET_STATE_STATUS
SET_STATE_USERINFO不知道是不是redux的问题
大概知道什么问题了,目前实现机制是只要 store 有变化会把所有依赖的 computed props 都重新触发一次计算,导致你这边触发了两次,我这边看下做下优化吧。
from okam.
@githublyp 你可以更新到最新 0.4.0-beta.3 看下这里问题,这里做了下优化,具体修改逻辑可以看关联的 commit 记录,我先把这个 issue 关了,有问题再 open~
from okam.
Related Issues (20)
- was signed into my sons account
- App 脚本 app.js 配置时 文档里面 这样配置编译不通过,把globalData放到config 里面就不报错 HOT 4
- 误报,可以忽视,sorry
- 求支持v-前缀的兼容 HOT 1
- 配置项是正则表达式时merge函数会产生错误结果 HOT 1
- 模板中for循环可以正常使用,v-for不行
- 代码示例和线上项目收集 HOT 2
- template 中简写编译有误 HOT 1
- 如何使用 postcss 插件 HOT 2
- 内联样式当有逗号时编译错误 HOT 1
- 目前还在更新维护吗 HOT 3
- why would it called Okam? HOT 2
- vuex下通过mutation或action更新数据后,视图不更新 HOT 1
- 钉钉的小程序是怎么操作的? HOT 2
- ios下的input,@focus很慢,多个input 进行切换,状态不对
- okam框架中如何使用百度小程序的动态库? HOT 1
- okam css 后处理postcss支持其他postcss插件吗?比如雪碧图postcss-sprites,装了下插件依赖运行报错,若支持怎么配置? HOT 1
- 百度小程序无法找到 regeneratorRuntime 问题 HOT 2
- 百度小程序Page.onInit中不支持通过赋值this.xxx修改视图 HOT 1
- app.json未找到
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from okam.