update Select
This commit is contained in:
parent
255b69abd6
commit
74fb7cb03d
3 changed files with 14 additions and 8 deletions
|
@ -51,9 +51,9 @@
|
||||||
<Select v-model="model13" filterable allow-create @on-create="handleCreate" style="width:260px">
|
<Select v-model="model13" filterable allow-create @on-create="handleCreate" style="width:260px">
|
||||||
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
||||||
</Select>
|
</Select>
|
||||||
<!-- <Select v-model="model12" multiple filterable allow-create @on-create="handleCreate" style="width:260px">-->
|
<Select v-model="model12" multiple filterable allow-create @on-create="handleCreate" style="width:260px">
|
||||||
<!-- <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>-->
|
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
|
||||||
<!-- </Select>-->
|
</Select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -68,7 +68,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'London',
|
value: 'London',
|
||||||
label: 'London2'
|
label: 'London'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'Sydney',
|
value: 'Sydney',
|
||||||
|
|
|
@ -225,7 +225,7 @@
|
||||||
this.$emit('on-input-focus');
|
this.$emit('on-input-focus');
|
||||||
},
|
},
|
||||||
onInputBlur () {
|
onInputBlur () {
|
||||||
if (this.allowCreate && this.showNotFoundLabel && this.query !== '') return;
|
if (this.allowCreate && this.query !== '') return;
|
||||||
if (!this.values.length) this.query = ''; // #5155
|
if (!this.values.length) this.query = ''; // #5155
|
||||||
this.$emit('on-input-blur');
|
this.$emit('on-input-blur');
|
||||||
},
|
},
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
import Drop from './dropdown.vue';
|
import Drop from './dropdown.vue';
|
||||||
import {directive as clickOutside} from 'v-click-outside-x';
|
import {directive as clickOutside} from 'v-click-outside-x';
|
||||||
import TransferDom from '../../directives/transfer-dom';
|
import TransferDom from '../../directives/transfer-dom';
|
||||||
import { oneOf } from '../../utils/assist';
|
import { oneOf, findComponentsDownward } from '../../utils/assist';
|
||||||
import Emitter from '../../mixins/emitter';
|
import Emitter from '../../mixins/emitter';
|
||||||
import Locale from '../../mixins/locale';
|
import Locale from '../../mixins/locale';
|
||||||
import SelectHead from './select-head.vue';
|
import SelectHead from './select-head.vue';
|
||||||
|
@ -341,7 +341,13 @@
|
||||||
},
|
},
|
||||||
showCreateItem () {
|
showCreateItem () {
|
||||||
let state = false;
|
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;
|
return state;
|
||||||
},
|
},
|
||||||
transitionName () {
|
transitionName () {
|
||||||
|
@ -715,7 +721,7 @@
|
||||||
},
|
},
|
||||||
// 4.0.0 create new item
|
// 4.0.0 create new item
|
||||||
handleCreateItem () {
|
handleCreateItem () {
|
||||||
if (this.allowCreate && this.showNotFoundLabel) {
|
if (this.allowCreate && this.query !== '') {
|
||||||
const query = this.query;
|
const query = this.query;
|
||||||
this.$emit('on-create', query);
|
this.$emit('on-create', query);
|
||||||
this.query = '';
|
this.query = '';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue