Skip to content

Commit

Permalink
fix(core): fixed computed in lifycycle seq issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Gcaufy committed Mar 20, 2019
1 parent eb5add2 commit 4164ba3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/core/weapp/init/render.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Watcher from './../observer/watcher';
import { callUserHook } from './hooks';
import { isFunc, isArr, isStr, isObj, isUndef, noop, clone } from './../util/index';
import { nextTick } from '../util/next-tick';
import { renderFlushCallbacks } from './../util/next-tick';


Expand Down Expand Up @@ -32,9 +33,9 @@ export function initRender (vm, keys) {
if (dirty) {
// init render is in lifecycle, setData in lifecycle will not work, so setTimeout is needed.
if (!vm._init) {
setTimeout(() => {
nextTick(function () {
vm.$wx.setData(dirty, renderFlushCallbacks);
});
})
} else {
vm.$wx.setData(dirty, renderFlushCallbacks);
}
Expand Down

0 comments on commit 4164ba3

Please sign in to comment.