Ver Fonte

warn against v-repeat on <option>

Evan You há 11 anos atrás
pai
commit
215949bacc
1 ficheiros alterados com 12 adições e 0 exclusões
  1. 12 0
      src/directives/repeat.js

+ 12 - 0
src/directives/repeat.js

@@ -45,6 +45,18 @@ module.exports = {
     this.enterStagger = +this._checkParam('enter-stagger') || stagger
     this.leaveStagger = +this._checkParam('leave-stagger') || stagger
     this.cache = Object.create(null)
+    // some helpful tips...
+    /* istanbul ignore if */
+    if (
+      process.env.NODE_ENV !== 'production' &&
+      this.el.tagName === 'OPTION'
+    ) {
+      _.warn(
+        'Don\'t use v-repeat for v-model options; ' +
+        'use the `options` param instead: ' +
+        'http://vuejs.org/guide/forms.html#Dynamic_Select_Options'
+      )
+    }
   },
 
   /**