Pārlūkot izejas kodu

x-model selects falsy values in select dropdown

Simone Todaro 4 gadi atpakaļ
vecāks
revīzija
9890a29dd3
3 mainītis faili ar 3 papildinājumiem un 3 dzēšanām
  1. 1 1
      dist/alpine-ie11.js
  2. 1 1
      dist/alpine.js
  3. 1 1
      src/directives/bind.js

+ 1 - 1
dist/alpine-ie11.js

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

+ 1 - 1
dist/alpine.js

@@ -752,7 +752,7 @@
       return value + '';
       return value + '';
     });
     });
     Array.from(el.options).forEach(option => {
     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 + '' })
     const arrayWrappedValue = [].concat(value).map(value => { return value + '' })
 
 
     Array.from(el.options).forEach(option => {
     Array.from(el.options).forEach(option => {
-        option.selected = arrayWrappedValue.includes(option.value || option.text)
+        option.selected = arrayWrappedValue.includes(option.value)
     })
     })
 }
 }