Forráskód Böngészése

Select: fix priority of label and value

kingwl 8 éve
szülő
commit
2f37355136
2 módosított fájl, 5 hozzáadás és 1 törlés
  1. 4 0
      packages/select/src/option.vue
  2. 1 1
      packages/select/src/select.vue

+ 4 - 0
packages/select/src/option.vue

@@ -50,6 +50,10 @@
         return this.label || ((typeof this.value === 'string' || typeof this.value === 'number') ? this.value : '');
       },
 
+      currentValue() {
+        return this.value || this.label || '';
+      },
+
       parent() {
         let result = this.$parent;
         while (!result.isSelect) {

+ 1 - 1
packages/select/src/select.vue

@@ -421,7 +421,7 @@
         } else {
           let optionIndex = -1;
           this.selected.forEach((item, index) => {
-            if (item === option || item.currentLabel === option.currentLabel) {
+            if (item === option || item.currentValue === option.currentValue) {
               optionIndex = index;
             }
           });