xxxxxxxxxx
1
<template>
2
<div class="container mt-115">
3
<div class="row">
4
<div class="col-4">
5
<MDBAutocomplete id="client" autocomplete="true" v-model="autocompleteBasic" :filter="filterOptions" label="Example label" :displayValue="displayValueDisplay" @itemSelect="selectAuto()" @close="closeAuto()" />
6
</div>
7
</div>
8
</div>
9
</template>
xxxxxxxxxx
1
<style>
2
#app {
3
font-family: Roboto, Helvetica, Arial, sans-serif;
4
}
5
</style>
xxxxxxxxxx
1
import {
2
MDBSelect,
3
MDBAutocomplete
4
} from "mdb-vue-ui-kit";
5
import {
6
ref
7
} from "vue";
8
9
export default {
10
components: {
11
MDBSelect,
12
MDBAutocomplete,
13
},
14
setup() {
15
const PartiesList = ref([]);
16
const getItems = ref([]);
17
const filterOptions = (value) => {
18
let starttime = Date.now();
19
let flag = "";
20
let filteredOptions = PartiesList.value.filter((item) => {
21
if (item) {
22
return item.toLowerCase().startsWith(value.toLowerCase());
23
}
24
});
25
let returnOptions = [];
26
if (filteredOptions.length > 0) {
27
returnOptions = filteredOptions;
28
}
29
return returnOptions;
30
};
31
const displayValueDisplay = (value) => value.toUpperCase();
32
return {
33
PartiesList,
34
getItems,
35
filterOptions,
36
displayValueDisplay,
37
};
38
},
39
mounted() {
40
this.PartiesList = ["Party 1", "Party 2", "Party 3"];
41
},
42
methods: {
43
selectAuto() {
44
console.log('value before timeout' + document.getElementById('client').value);
45
setTimeout(function(){
46
console.log('value after timeout' + document.getElementById('client').value);
47
}, 500);
48
},
49
closeAuto() {
50
console.log("close Auto");
51
},
52
},
53
};
Console errors: 0