1
1
<script setup lang='ts'>
2
- const primeAttributes = ' placeholder, separator, allowDuplicate, max, addOnBlur '
2
+ const primeAttributes = ' placeholder, multiple, typeahead, optionLabel, size, minLength, fluid '
3
3
4
4
const list = [' Hello' , ' Hero' , ' House' , ' World' ]
5
5
6
6
function search(query : string ) {
7
7
return [... list .filter (i => i .toLowerCase ().includes (query .toLowerCase ())), query ]
8
8
}
9
9
10
+ async function asyncSearch(query : string ) {
11
+ await new Promise (resolve => setTimeout (resolve , 1000 ))
12
+ return [... list .filter (i => i .toLowerCase ().includes (query .toLowerCase ())), query ]
13
+ }
14
+
10
15
const userList = [
11
16
{ id: ' 1' , name: ' Tom' , value: ' 123' },
12
17
{ id: ' 2' , name: ' Tim' , value: ' 124' },
@@ -22,6 +27,17 @@ const schema
22
27
dropdown: true ,
23
28
label: ' Basic AutoComplete - Use [h]ello' ,
24
29
},
30
+ {
31
+ $formkit: ' primeAutoComplete' ,
32
+ id: ' async' ,
33
+ name: ' async' ,
34
+ complete: asyncSearch ,
35
+ dropdown: true ,
36
+ label: ' Async AutoComplete - Use [he]llo' ,
37
+ minLength: 2 ,
38
+ placeholder: ' Type at least 2 characters' ,
39
+ fluid: true ,
40
+ },
25
41
{
26
42
$formkit: ' primeAutoComplete' ,
27
43
id: ' basic' ,
0 commit comments