Преглед изворни кода

bind value as property for <select> (fix #4369)

Evan You пре 9 година
родитељ
комит
1cf377f190
1 измењених фајлова са 2 додато и 1 уклоњено
  1. 2 1
      src/platforms/web/util/attrs.js

+ 2 - 1
src/platforms/web/util/attrs.js

@@ -3,9 +3,10 @@
 import { makeMap } from 'shared/util'
 import { makeMap } from 'shared/util'
 
 
 // attributes that should be using props for binding
 // attributes that should be using props for binding
+const acceptValue = makeMap('input,textarea,option,select')
 export const mustUseProp = (tag: string, attr: string): boolean => {
 export const mustUseProp = (tag: string, attr: string): boolean => {
   return (
   return (
-    (attr === 'value' && (tag === 'input' || tag === 'textarea' || tag === 'option')) ||
+    (attr === 'value' && acceptValue(tag)) ||
     (attr === 'selected' && tag === 'option') ||
     (attr === 'selected' && tag === 'option') ||
     (attr === 'checked' && tag === 'input') ||
     (attr === 'checked' && tag === 'input') ||
     (attr === 'muted' && tag === 'video')
     (attr === 'muted' && tag === 'video')