Explorar o código

remove unused _noSync option

Evan You %!s(int64=11) %!d(string=hai) anos
pai
achega
dc745af66b
Modificáronse 4 ficheiros con 8 adicións e 17 borrados
  1. 1 2
      src/directives/component.js
  2. 1 2
      src/directives/if.js
  3. 1 2
      src/directives/repeat.js
  4. 5 11
      src/directives/with.js

+ 1 - 2
src/directives/component.js

@@ -134,8 +134,7 @@ module.exports = {
     if (this.Ctor && !this.childVM) {
     if (this.Ctor && !this.childVM) {
       this.childVM = this.vm._addChild({
       this.childVM = this.vm._addChild({
         el: this.el.cloneNode(true),
         el: this.el.cloneNode(true),
-        parent: this.vm,
-        _noSync: true
+        parent: this.vm
       }, this.Ctor)
       }, this.Ctor)
       if (this.keepAlive) {
       if (this.keepAlive) {
         this.cache[this.id] = this.childVM
         this.cache[this.id] = this.childVM

+ 1 - 2
src/directives/if.js

@@ -41,8 +41,7 @@ module.exports = {
     this.childVM = this.vm._addChild({
     this.childVM = this.vm._addChild({
       el: this.el,
       el: this.el,
       parent: this.vm,
       parent: this.vm,
-      anonymous: true,
-      _noSync: true
+      anonymous: true
     })
     })
   },
   },
 
 

+ 1 - 2
src/directives/repeat.js

@@ -237,8 +237,7 @@ module.exports = {
     var vm = this.vm._addChild({
     var vm = this.vm._addChild({
       el: this.el.cloneNode(true),
       el: this.el.cloneNode(true),
       data: data,
       data: data,
-      parent: this.vm,
-      _noSync: hasAlias
+      parent: this.vm
     }, Ctor)
     }, Ctor)
     // define alias
     // define alias
     if (hasAlias && !alias) {
     if (hasAlias && !alias) {

+ 5 - 11
src/directives/with.js

@@ -5,18 +5,12 @@ module.exports = {
   priority: 900,
   priority: 900,
 
 
   bind: function () {
   bind: function () {
-    if (!this.arg) {
-      // by default, components have _noSync:true
-      // but when there's no arg it means we are
-      // inheriting a parent object as $data, so we have
-      // to sync the chagnes
-      this.vm.$options._noSync = false
+    if (this.arg) {
+      var self = this
+      this.vm.$watch(this.arg, function (val) {
+        self.set(_.toNumber(val))
+      })
     }
     }
-    var self = this
-    var path = this.arg || '$data'
-    this.vm.$watch(path, function (val) {
-      self.set(_.toNumber(val))
-    })
   },
   },
 
 
   update: function (value) {
   update: function (value) {