Skip to content

Commit

Permalink
~ change 事件触发对数据的影响
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudcome committed Jul 19, 2018
1 parent c469e65 commit 2fc4be6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/directives/models/text.js
Expand Up @@ -28,7 +28,9 @@ exports.init = function (directive) {
var node = directive.node;
var el = vm.root.el;
var compositionstart = false;
var setValue = function (value) {
var setValue = function () {
var value = node.value;

if (directive.filters.trim) {
value = value.trim();
}
Expand All @@ -42,7 +44,7 @@ exports.init = function (directive) {
}
}

directive.set(value);
directive.set(node.value = value);
};

event.on(node, COMPOSITIONSTART_EVENT, directive[COMPOSITIONSTART_LISTENER] = function () {
Expand All @@ -64,7 +66,7 @@ exports.init = function (directive) {
return;
}

setValue(node.value);
setValue();
}, 1);
});

Expand All @@ -78,7 +80,7 @@ exports.init = function (directive) {
var newVal = directive.get();

if (newVal !== node.value) {
setValue(node.value);
setValue();
}
});
};
Expand Down

0 comments on commit 2fc4be6

Please sign in to comment.