bug fixed #4441
This commit is contained in:
parent
d5c7ce3017
commit
e20098a32d
3 changed files with 32 additions and 19 deletions
|
@ -1,36 +1,47 @@
|
||||||
<template>
|
<template>
|
||||||
<div style="margin: 100px;width: 200px;">
|
<div style="margin: 100px;width: 200px;">
|
||||||
<AutoComplete placement="top" transfer v-model="value" icon="ios-search" :data="data" @on-search="handleSearch" @on-change="hc" :filter-method="fm">
|
<AutoComplete
|
||||||
|
placement="top"
|
||||||
|
transfer
|
||||||
|
v-model="value"
|
||||||
|
icon="ios-search"
|
||||||
|
:data="data"
|
||||||
|
@on-search="onHandleSearch"
|
||||||
|
@on-change="onChange"
|
||||||
|
@on-select="onSelect"
|
||||||
|
>
|
||||||
<!--<Option v-for="item in data" :value="item" :label="item" :key="item">-->
|
<!--<Option v-for="item in data" :value="item" :label="item" :key="item">-->
|
||||||
<!--<span style="color: red">{{ item }}</span>-->
|
<!--<span style="color: red">{{ item }}</span>-->
|
||||||
<!--</Option>-->
|
<!--</Option>-->
|
||||||
</AutoComplete>
|
</AutoComplete>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {},
|
||||||
|
|
||||||
},
|
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
value: '',
|
value: "",
|
||||||
data: [],
|
source: ["1", "2", "3", "11", "12", "13"],
|
||||||
// data: ['Burns Bay Road', 'Downing Street', 'Wall Street']
|
data: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
methods: {
|
methods: {
|
||||||
handleSearch (value) {
|
onHandleSearch (value) {
|
||||||
this.data = !value ? [] : [
|
let result = [];
|
||||||
value + '@qq.com',
|
for (let val of this.source) {
|
||||||
value + '@sina.com',
|
if (val.includes(value)) {
|
||||||
value + '@163.com'
|
result.push(val);
|
||||||
]
|
}
|
||||||
|
}
|
||||||
|
this.data = result;
|
||||||
},
|
},
|
||||||
hc (v) {
|
onSelect (e) {
|
||||||
// console.log(v)
|
console.log('onSelect', e);
|
||||||
|
},
|
||||||
|
onChange (v) {
|
||||||
|
console.log("onChange", v);
|
||||||
},
|
},
|
||||||
fm (value, item) {
|
fm (value, item) {
|
||||||
return item.toUpperCase().indexOf(value.toUpperCase()) !== -1;
|
return item.toUpperCase().indexOf(value.toUpperCase()) !== -1;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
remote
|
remote
|
||||||
auto-complete
|
auto-complete
|
||||||
:remote-method="remoteMethod"
|
:remote-method="remoteMethod"
|
||||||
@on-change="handleChange"
|
@on-select="handleSelect"
|
||||||
@on-clickoutside="handleClickOutside"
|
@on-clickoutside="handleClickOutside"
|
||||||
:transfer="transfer">
|
:transfer="transfer">
|
||||||
<slot name="input">
|
<slot name="input">
|
||||||
|
@ -152,9 +152,10 @@
|
||||||
remoteMethod (query) {
|
remoteMethod (query) {
|
||||||
this.$emit('on-search', query);
|
this.$emit('on-search', query);
|
||||||
},
|
},
|
||||||
handleChange (val) {
|
handleSelect (val) {
|
||||||
if (val === undefined || val === null) return;
|
if (val === undefined || val === null) return;
|
||||||
this.currentValue = val;
|
this.currentValue = val;
|
||||||
|
|
||||||
this.$refs.input.blur();
|
this.$refs.input.blur();
|
||||||
this.$emit('on-select', val);
|
this.$emit('on-select', val);
|
||||||
},
|
},
|
||||||
|
|
|
@ -661,6 +661,7 @@
|
||||||
if (!this.autoComplete) this.$nextTick(() => inputField.focus());
|
if (!this.autoComplete) this.$nextTick(() => inputField.focus());
|
||||||
}
|
}
|
||||||
this.broadcast('Drop', 'on-update-popper');
|
this.broadcast('Drop', 'on-update-popper');
|
||||||
|
this.$emit('on-select', this.publicValue); // # 4441
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.filterQueryChange = false;
|
this.filterQueryChange = false;
|
||||||
}, ANIMATION_TIMEOUT);
|
}, ANIMATION_TIMEOUT);
|
||||||
|
|
Loading…
Add table
Reference in a new issue