提交 9c3d4a6e 编写于 作者: fxy060608's avatar fxy060608

fix(mp): pre watchers triggered synchronously (#3648)

上级 9e47e01e
......@@ -2022,7 +2022,17 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
}
else {
// default: 'pre'
scheduler = () => queuePreFlushCb(job);
scheduler = () => {
if (!instance || instance.isMounted) {
queuePreFlushCb(job);
}
else {
// with 'pre' option, the first call must happen before
// the component is mounted so it is called synchronously.
// fixed by xxxxxx https://github.com/dcloudio/uni-app/issues/3648
job();
}
};
}
const effect = new ReactiveEffect(getter, scheduler);
if ((process.env.NODE_ENV !== 'production')) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册