Evan You 11 lat temu
rodzic
commit
f016fe4982
1 zmienionych plików z 5 dodań i 9 usunięć
  1. 5 9
      src/directives/if.js

+ 5 - 9
src/directives/if.js

@@ -26,7 +26,11 @@ module.exports = {
     if (value) {
       if (!this.inserted) {
         if (!this.childVM) {
-          this.build()
+          this.childVM = this.vm.$addChild({
+            el: this.el,
+            parent: this.vm,
+            _anonymous: true
+          })
         }
         this.childVM.$before(this.ref)
         this.inserted = true
@@ -39,14 +43,6 @@ module.exports = {
     }
   },
 
-  build: function () {
-    this.childVM = this.vm.$addChild({
-      el: this.el,
-      parent: this.vm,
-      _anonymous: true
-    })
-  },
-
   unbind: function () {
     if (this.childVM) {
       this.childVM.$destroy()