fixed #915
This commit is contained in:
parent
78d8ea4d4a
commit
c70ff0f294
2 changed files with 11 additions and 7 deletions
|
@ -2,7 +2,7 @@
|
||||||
<Row>
|
<Row>
|
||||||
<i-col span="4">{{model}}</i-col>
|
<i-col span="4">{{model}}</i-col>
|
||||||
<i-col span="8">
|
<i-col span="8">
|
||||||
<i-select v-model="model" @input="handleInput" multiple filterable remote :remote-method="remoteMethod" :loading="loading" clearable>
|
<i-select v-model="model" @input="handleInput" filterable remote :remote-method="remoteMethod" :loading="loading" clearable>
|
||||||
<i-option v-for="option in options" :value="option.value" :key="new Date()">{{option.label}}</i-option>
|
<i-option v-for="option in options" :value="option.value" :key="new Date()">{{option.label}}</i-option>
|
||||||
</i-select>
|
</i-select>
|
||||||
</i-col>
|
</i-col>
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
model: [],
|
model: '',
|
||||||
options: [
|
options: [
|
||||||
|
|
||||||
],
|
],
|
||||||
|
@ -93,7 +93,10 @@
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.list = this.states.map(item => {
|
this.list = this.states.map(item => {
|
||||||
return { value: item, label: item };
|
return {
|
||||||
|
value: item,
|
||||||
|
label: 'L ' + item
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,6 +118,7 @@
|
||||||
selectedMultiple: [],
|
selectedMultiple: [],
|
||||||
focusIndex: 0,
|
focusIndex: 0,
|
||||||
query: '',
|
query: '',
|
||||||
|
lastQuery: '',
|
||||||
selectToChangeQuery: false, // when select an option, set this first and set query, because query is watching, it will emit event
|
selectToChangeQuery: false, // when select an option, set this first and set query, because query is watching, it will emit event
|
||||||
inputLength: 20,
|
inputLength: 20,
|
||||||
notFound: false,
|
notFound: false,
|
||||||
|
@ -528,10 +529,10 @@
|
||||||
this.query = child.label === undefined ? child.searchLabel : child.label;
|
this.query = child.label === undefined ? child.searchLabel : child.label;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 如果删除了搜索词,下拉列表也情况了,所以强制调用一次remoteMethod
|
// 如果删除了搜索词,下拉列表也清空了,所以强制调用一次remoteMethod
|
||||||
if (this.remote) {
|
if (this.remote && this.query !== this.lastQuery) {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.query = model;
|
this.query = this.lastQuery;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -645,7 +646,7 @@
|
||||||
this.findChild((child) => {
|
this.findChild((child) => {
|
||||||
if (child.value === value) {
|
if (child.value === value) {
|
||||||
if (this.query !== '') this.selectToChangeQuery = true;
|
if (this.query !== '') this.selectToChangeQuery = true;
|
||||||
this.query = child.label === undefined ? child.searchLabel : child.label;
|
this.lastQuery = this.query = child.label === undefined ? child.searchLabel : child.label;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue