diff --git a/examples/routers/select.vue b/examples/routers/select.vue
index 091cf4e5..2e8b06ff 100644
--- a/examples/routers/select.vue
+++ b/examples/routers/select.vue
@@ -51,9 +51,9 @@
-
-
-
+
@@ -68,7 +68,7 @@
},
{
value: 'London',
- label: 'London2'
+ label: 'London'
},
{
value: 'Sydney',
diff --git a/src/components/select/select-head.vue b/src/components/select/select-head.vue
index 70fa2bc7..42ae3d1e 100644
--- a/src/components/select/select-head.vue
+++ b/src/components/select/select-head.vue
@@ -225,7 +225,7 @@
this.$emit('on-input-focus');
},
onInputBlur () {
- if (this.allowCreate && this.showNotFoundLabel && this.query !== '') return;
+ if (this.allowCreate && this.query !== '') return;
if (!this.values.length) this.query = ''; // #5155
this.$emit('on-input-blur');
},
diff --git a/src/components/select/select.vue b/src/components/select/select.vue
index 2f3bf4a9..162c0b02 100644
--- a/src/components/select/select.vue
+++ b/src/components/select/select.vue
@@ -85,7 +85,7 @@
import Drop from './dropdown.vue';
import {directive as clickOutside} from 'v-click-outside-x';
import TransferDom from '../../directives/transfer-dom';
- import { oneOf } from '../../utils/assist';
+ import { oneOf, findComponentsDownward } from '../../utils/assist';
import Emitter from '../../mixins/emitter';
import Locale from '../../mixins/locale';
import SelectHead from './select-head.vue';
@@ -341,7 +341,13 @@
},
showCreateItem () {
let state = false;
- if (this.allowCreate && this.query !== '') state = true;
+ if (this.allowCreate && this.query !== '') {
+ state = true;
+ const $options = findComponentsDownward(this, 'iOption');
+ if ($options && $options.length) {
+ if ($options.find(item => item.showLabel === this.query)) state = false;
+ }
+ }
return state;
},
transitionName () {
@@ -715,7 +721,7 @@
},
// 4.0.0 create new item
handleCreateItem () {
- if (this.allowCreate && this.showNotFoundLabel) {
+ if (this.allowCreate && this.query !== '') {
const query = this.query;
this.$emit('on-create', query);
this.query = '';