Jelajahi Sumber

Merge pull request #2540 from Leopoldthecoder/dev

Select: fix disabled multiple filterable bug, add missing scrollbar s…
baiyaaaaa 8 tahun lalu
induk
melakukan
1f46067055

+ 4 - 2
packages/select/src/select.vue

@@ -26,6 +26,7 @@
         class="el-select__input"
         :class="`is-${ size }`"
         @focus="visible = true"
+        :disabled="disabled"
         @keyup="managePlaceholder"
         @keydown="resetInputState"
         @keydown.down.prevent="navigateOptions('next')"
@@ -364,10 +365,11 @@
 
       getOption(value) {
         let option;
-        for (let i = 0, len = this.cachedOptions.length; i < len; i++) {
+        for (let i = this.cachedOptions.length - 1; i >= 0; i--) {
           const cachedOption = this.cachedOptions[i];
           if (cachedOption.value === value) {
             option = cachedOption;
+            break;
           }
         }
         if (option) return option;
@@ -513,8 +515,8 @@
           if (option.created) {
             this.query = '';
             this.inputLength = 20;
-            this.$refs.input.focus();
           }
+          if (this.filterable) this.$refs.input.focus();
         }
       },
 

+ 1 - 1
packages/theme-default/src/common/var.css

@@ -515,7 +515,7 @@
   --steps-border-radius: 4px;
   --steps-padding: 20px;
 
-  /* Steps
+  /* Menu
   --------------------------*/
   --menu-item-color: var(--link-color);
   --menu-item-fill: var(--color-extra-light-gray);

+ 1 - 0
packages/theme-default/src/date-picker.css

@@ -8,3 +8,4 @@
 @import "./date-picker/time-range-picker.css";
 @import "./date-picker/time-picker.css";
 @import "./input.css";
+@import "./scrollbar.css";

+ 1 - 0
packages/theme-default/src/select.css

@@ -5,6 +5,7 @@
 @import "./tag.css";
 @import "./option.css";
 @import "./option-group.css";
+@import "./scrollbar.css";
 
 @component-namespace el {
 

+ 1 - 0
packages/theme-default/src/time-picker.css

@@ -2,3 +2,4 @@
 @import "./date-picker/time-spinner.css";
 @import "./date-picker/time-picker.css";
 @import "./input.css";
+@import "./scrollbar.css";

+ 1 - 0
packages/theme-default/src/time-select.css

@@ -1,6 +1,7 @@
 @import "./date-picker/picker.css";
 @import "./date-picker/date-picker.css";
 @import "./common/var.css";
+@import "./scrollbar.css";
 
 .time-select {
   margin: 5px 0;