Ver Fonte

fix v-model select off-dom infinite loop (fix #3104)

Evan You há 10 anos atrás
pai
commit
2aafe10762
1 ficheiros alterados com 3 adições e 3 exclusões
  1. 3 3
      src/directives/public/model/select.js

+ 3 - 3
src/directives/public/model/select.js

@@ -48,13 +48,13 @@ export default {
     this.vm.$on('hook:attached', () => {
     this.vm.$on('hook:attached', () => {
       nextTick(this.forceUpdate)
       nextTick(this.forceUpdate)
     })
     })
+    if (!inDoc(el)) {
+      nextTick(this.forceUpdate)
+    }
   },
   },
 
 
   update (value) {
   update (value) {
     var el = this.el
     var el = this.el
-    if (!inDoc(el)) {
-      return nextTick(this.forceUpdate)
-    }
     el.selectedIndex = -1
     el.selectedIndex = -1
     var multi = this.multiple && isArray(value)
     var multi = this.multiple && isArray(value)
     var options = el.options
     var options = el.options