parent
7413c75af3
commit
3fb66d8331
@ -1,36 +1,37 @@
|
||||
<template>
|
||||
<div>
|
||||
<slot :filter="filter"> </slot>
|
||||
</div>
|
||||
<div>
|
||||
<slot :filter="filter"></slot>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
let cancelId;
|
||||
let cancelId;
|
||||
|
||||
export default {
|
||||
name: "AutoCompleteWrapper",
|
||||
props: {
|
||||
callback: {
|
||||
type: Function,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
filter(e) {
|
||||
clearTimeout(cancelId);
|
||||
if (
|
||||
e.target.value &&
|
||||
e.target.value.length > 1 &&
|
||||
e.code !== "Tab" &&
|
||||
e.code !== "Enter"
|
||||
) {
|
||||
cancelId = setTimeout(() => {
|
||||
this.callback(e.target.value);
|
||||
}, 400);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
export default {
|
||||
name: "AutoCompleteWrapper",
|
||||
props: {
|
||||
callback: {
|
||||
type: Function,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
filter(e) {
|
||||
clearTimeout(cancelId);
|
||||
if (
|
||||
e.target.value &&
|
||||
e.target.value.length > 1 &&
|
||||
e.code !== "Tab" &&
|
||||
e.code !== "Enter"
|
||||
) {
|
||||
cancelId = setTimeout(() => {
|
||||
this.$emit('filter', e.target.value);
|
||||
this.callback(e.target.value);
|
||||
}, 400);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
</style>
|
||||
|
Loading…
Reference in new issue