fixed #566
This commit is contained in:
parent
7409cb3c27
commit
15b72d31b0
2 changed files with 43 additions and 226 deletions
|
@ -1,206 +1,16 @@
|
||||||
<!--<template>-->
|
|
||||||
<!--<div>-->
|
|
||||||
<!--<i-select v-model="model1" style="width:200px" clearable>-->
|
|
||||||
<!--<i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option>-->
|
|
||||||
<!--</i-select>-->
|
|
||||||
<!--{{ model1 }}-->
|
|
||||||
<!--<div @click="c">change</div>-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--</template>-->
|
|
||||||
<!--<script>-->
|
|
||||||
<!--export default {-->
|
|
||||||
<!--data () {-->
|
|
||||||
<!--return {-->
|
|
||||||
<!--cityList: [-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'beijing',-->
|
|
||||||
<!--label: '北京市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'shanghai',-->
|
|
||||||
<!--label: '上海市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'shenzhen',-->
|
|
||||||
<!--label: '深圳市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'hangzhou',-->
|
|
||||||
<!--label: '杭州市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'nanjing',-->
|
|
||||||
<!--label: '南京市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'chongqing',-->
|
|
||||||
<!--label: '重庆市'-->
|
|
||||||
<!--}-->
|
|
||||||
<!--],-->
|
|
||||||
<!--model1: ''-->
|
|
||||||
<!--}-->
|
|
||||||
<!--},-->
|
|
||||||
<!--methods: {-->
|
|
||||||
<!--c () {-->
|
|
||||||
<!--this.model1 = 'hangzhou'-->
|
|
||||||
<!--}-->
|
|
||||||
<!--}-->
|
|
||||||
<!--}-->
|
|
||||||
<!--</script>-->
|
|
||||||
|
|
||||||
|
|
||||||
<!--<template>-->
|
|
||||||
<!--<div>-->
|
|
||||||
<!--<i-select v-model="model5" disabled style="width:200px">-->
|
|
||||||
<!--<i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option>-->
|
|
||||||
<!--</i-select>-->
|
|
||||||
<!--<i-select v-model="model6" style="width:200px">-->
|
|
||||||
<!--<i-option value="beijing">北京市</i-option>-->
|
|
||||||
<!--<i-option value="shanghai" disabled>上海市</i-option>-->
|
|
||||||
<!--<i-option value="shenzhen">深圳市</i-option>-->
|
|
||||||
<!--</i-select>-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--</template>-->
|
|
||||||
<!--<script>-->
|
|
||||||
<!--export default {-->
|
|
||||||
<!--data () {-->
|
|
||||||
<!--return {-->
|
|
||||||
<!--cityList: [-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'beijing',-->
|
|
||||||
<!--label: '北京市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'shanghai',-->
|
|
||||||
<!--label: '上海市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'shenzhen',-->
|
|
||||||
<!--label: '深圳市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'hangzhou',-->
|
|
||||||
<!--label: '杭州市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'nanjing',-->
|
|
||||||
<!--label: '南京市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'chongqing',-->
|
|
||||||
<!--label: '重庆市'-->
|
|
||||||
<!--}-->
|
|
||||||
<!--],-->
|
|
||||||
<!--model5: '',-->
|
|
||||||
<!--model6: ''-->
|
|
||||||
<!--}-->
|
|
||||||
<!--}-->
|
|
||||||
<!--}-->
|
|
||||||
<!--</script>-->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--<template>-->
|
|
||||||
<!--<div>-->
|
|
||||||
<!--<i-select v-model="model7" style="width:200px">-->
|
|
||||||
<!--<Option-group label="热门城市">-->
|
|
||||||
<!--<i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option>-->
|
|
||||||
<!--</Option-group>-->
|
|
||||||
<!--<Option-group label="其它城市">-->
|
|
||||||
<!--<i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option>-->
|
|
||||||
<!--</Option-group>-->
|
|
||||||
<!--</i-select>-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--</template>-->
|
|
||||||
<!--<script>-->
|
|
||||||
<!--export default {-->
|
|
||||||
<!--data () {-->
|
|
||||||
<!--return {-->
|
|
||||||
<!--cityList: [-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'beijing',-->
|
|
||||||
<!--label: '北京市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'shanghai',-->
|
|
||||||
<!--label: '上海市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'shenzhen',-->
|
|
||||||
<!--label: '深圳市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'hangzhou',-->
|
|
||||||
<!--label: '杭州市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'nanjing',-->
|
|
||||||
<!--label: '南京市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'chongqing',-->
|
|
||||||
<!--label: '重庆市'-->
|
|
||||||
<!--}-->
|
|
||||||
<!--],-->
|
|
||||||
<!--model7: ''-->
|
|
||||||
<!--}-->
|
|
||||||
<!--}-->
|
|
||||||
<!--}-->
|
|
||||||
<!--</script>-->
|
|
||||||
|
|
||||||
<!--<template>-->
|
|
||||||
<!--<div>-->
|
|
||||||
<!--<i-select v-model="model10" multiple style="width:260px">-->
|
|
||||||
<!--<i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option>-->
|
|
||||||
<!--</i-select>-->
|
|
||||||
<!--</div>-->
|
|
||||||
<!--</template>-->
|
|
||||||
<!--<script>-->
|
|
||||||
<!--export default {-->
|
|
||||||
<!--data () {-->
|
|
||||||
<!--return {-->
|
|
||||||
<!--cityList: [-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'beijing',-->
|
|
||||||
<!--label: '北京市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'shanghai',-->
|
|
||||||
<!--label: '上海市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'shenzhen',-->
|
|
||||||
<!--label: '深圳市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'hangzhou',-->
|
|
||||||
<!--label: '杭州市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'nanjing',-->
|
|
||||||
<!--label: '南京市'-->
|
|
||||||
<!--},-->
|
|
||||||
<!--{-->
|
|
||||||
<!--value: 'chongqing',-->
|
|
||||||
<!--label: '重庆市'-->
|
|
||||||
<!--}-->
|
|
||||||
<!--],-->
|
|
||||||
<!--model10: []-->
|
|
||||||
<!--}-->
|
|
||||||
<!--}-->
|
|
||||||
<!--}-->
|
|
||||||
<!--</script>-->
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div style="margin: 1000px 0 0 ">
|
<Row>
|
||||||
<Select v-model="model1" style="width:200px">
|
<i-col span="12" style="padding-right:10px">
|
||||||
|
<Select v-model="model11" filterable>
|
||||||
<Option v-for="item in cityList" :value="item.value" :key="item">{{ item.label }}</Option>
|
<Option v-for="item in cityList" :value="item.value" :key="item">{{ item.label }}</Option>
|
||||||
</Select>
|
</Select>
|
||||||
{{ model1 }}
|
</i-col>
|
||||||
<Button @click="set">set</Button>
|
<i-col span="12">
|
||||||
<Button @click="add">add</Button>
|
<Select v-model="model12" filterable multiple>
|
||||||
<Button @click="remove">remove</Button>
|
<Option v-for="item in cityList" :value="item.value" :key="item">{{ item.label }}</Option>
|
||||||
</div>
|
</Select>
|
||||||
|
</i-col>
|
||||||
|
</Row>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
|
@ -218,26 +28,22 @@
|
||||||
{
|
{
|
||||||
value: 'shenzhen',
|
value: 'shenzhen',
|
||||||
label: '深圳市'
|
label: '深圳市'
|
||||||
}
|
|
||||||
],
|
|
||||||
model1: ''
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
{
|
||||||
clear(){
|
value: 'hangzhou',
|
||||||
this.d = [];
|
label: '杭州市'
|
||||||
},
|
},
|
||||||
set () {
|
{
|
||||||
this.model1 = 'shenzhen';
|
value: 'nanjing',
|
||||||
|
label: '南京市'
|
||||||
},
|
},
|
||||||
add () {
|
{
|
||||||
this.cityList.push({
|
|
||||||
value: 'chongqing',
|
value: 'chongqing',
|
||||||
label: '重庆市'
|
label: '重庆市'
|
||||||
});
|
}
|
||||||
},
|
],
|
||||||
remove () {
|
model11: '',
|
||||||
this.cityList.splice(0, 1);
|
model12: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -506,6 +506,14 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
broadcastQuery (val) {
|
||||||
|
if (findComponentDownward(this, 'OptionGroup')) {
|
||||||
|
this.broadcast('OptionGroup', 'on-query-change', val);
|
||||||
|
this.broadcast('iOption', 'on-query-change', val);
|
||||||
|
} else {
|
||||||
|
this.broadcast('iOption', 'on-query-change', val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
@ -579,13 +587,21 @@
|
||||||
},
|
},
|
||||||
visible (val) {
|
visible (val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
if (this.multiple && this.filterable) {
|
if (this.filterable) {
|
||||||
|
if (this.multiple) {
|
||||||
this.$refs.input.focus();
|
this.$refs.input.focus();
|
||||||
|
} else {
|
||||||
|
this.$refs.input.select();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.broadcast('Drop', 'on-update-popper');
|
this.broadcast('Drop', 'on-update-popper');
|
||||||
} else {
|
} else {
|
||||||
if (this.filterable) {
|
if (this.filterable) {
|
||||||
this.$refs.input.blur();
|
this.$refs.input.blur();
|
||||||
|
// #566 reset options visible
|
||||||
|
setTimeout(() => {
|
||||||
|
this.broadcastQuery('');
|
||||||
|
}, 300);
|
||||||
}
|
}
|
||||||
this.broadcast('Drop', 'on-destroy-popper');
|
this.broadcast('Drop', 'on-destroy-popper');
|
||||||
}
|
}
|
||||||
|
@ -593,12 +609,7 @@
|
||||||
query (val) {
|
query (val) {
|
||||||
this.$emit('on-query-change', val);
|
this.$emit('on-query-change', val);
|
||||||
|
|
||||||
if (findComponentDownward(this, 'OptionGroup')) {
|
this.broadcastQuery(val);
|
||||||
this.broadcast('OptionGroup', 'on-query-change', val);
|
|
||||||
this.broadcast('iOption', 'on-query-change', val);
|
|
||||||
} else {
|
|
||||||
this.broadcast('iOption', 'on-query-change', val);
|
|
||||||
}
|
|
||||||
|
|
||||||
let is_hidden = true;
|
let is_hidden = true;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue