Skip to content

Commit

Permalink
use pre-hook for setting up prop two-way sync (fix vuejs#2064)
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Dec 24, 2015
1 parent fa53d96 commit 03b580e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/directives/internal/prop.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default {
// important: defer the child watcher creation until
// the created hook (after data observation)
var self = this
child.$once('hook:created', function () {
child.$once('pre-hook:created', function () {
self.childWatcher = new Watcher(
child,
childKey,
Expand Down
2 changes: 1 addition & 1 deletion src/directives/public/cloak.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default {
bind () {
var el = this.el
this.vm.$once('hook:compiled', function () {
this.vm.$once('pre-hook:compiled', function () {
el.removeAttribute('v-cloak')
})
}
Expand Down
1 change: 1 addition & 0 deletions src/instance/internal/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export default function (Vue) {
*/

Vue.prototype._callHook = function (hook) {
this.$emit('pre-hook:' + hook)
var handlers = this.$options[hook]
if (handlers) {
for (var i = 0, j = handlers.length; i < j; i++) {
Expand Down

0 comments on commit 03b580e

Please sign in to comment.