1
0
Эх сурвалжийг харах

x-model selects falsy values in select dropdown

Simone Todaro 4 жил өмнө
parent
commit
9890a29dd3

+ 1 - 1
dist/alpine-ie11.js

@@ -6715,7 +6715,7 @@
     Array.from(el.options).forEach(function (option) {
       _newArrowCheck(this, _this3);
 
-      option.selected = arrayWrappedValue.includes(option.value || option.text);
+      option.selected = arrayWrappedValue.includes(option.value);
     }.bind(this));
   }
 

+ 1 - 1
dist/alpine.js

@@ -752,7 +752,7 @@
       return value + '';
     });
     Array.from(el.options).forEach(option => {
-      option.selected = arrayWrappedValue.includes(option.value || option.text);
+      option.selected = arrayWrappedValue.includes(option.value);
     });
   }
 

+ 1 - 1
src/directives/bind.js

@@ -87,6 +87,6 @@ function updateSelect(el, value) {
     const arrayWrappedValue = [].concat(value).map(value => { return value + '' })
 
     Array.from(el.options).forEach(option => {
-        option.selected = arrayWrappedValue.includes(option.value || option.text)
+        option.selected = arrayWrappedValue.includes(option.value)
     })
 }