Skip to content

Commit

Permalink
fix: child data cannot sync to parent in some case, closes #235
Browse files Browse the repository at this point in the history
  • Loading branch information
fengzilong committed Jan 18, 2019
1 parent 3bbc847 commit ef2b124
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
10 changes: 7 additions & 3 deletions dist/regular.js
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ return /******/ (function(modules) { // webpackBootstrap
}
return paramObj;
}
_.eventReg = /^on-(\w[-\w]+)$/;
_.eventReg = /^on-(\w[-\w]*)$/;

_.toText = function(obj){
return obj == null ? "": "" + obj;
Expand Down Expand Up @@ -4906,12 +4906,16 @@ return /******/ (function(modules) { // webpackBootstrap
value = self._touchExpr(value);
// use bit operate to control scope
if( !(isolate & 2) )
// sync data from parent to child
this.$watch(value, (function(name, val){
this.data[name] = val;
}).bind(component, name), OPTIONS.SYNC)
if( value.set && !(isolate & 1 ) )
// sync the data. it force the component don't trigger attr.name's first dirty echeck
component.$watch(name, self.$update.bind(self, value), OPTIONS.INIT);
// sync data from child to parent. it force the component don't trigger attr.name's first dirty echeck
component.$watch(name, self.$update.bind(self, value), {
init: true,
last: this.data[ name ]
});
}
}
if(is && is.type === 'expression' ){
Expand Down
Loading

0 comments on commit ef2b124

Please sign in to comment.