11<script setup lang='ts'>
2- const primeAttributes = ' placeholder, separator, allowDuplicate, max, addOnBlur '
2+ const primeAttributes = ' placeholder, multiple, typeahead, optionLabel, size, minLength, fluid '
33
44const list = [' Hello' , ' Hero' , ' House' , ' World' ]
55
66function search(query : string ) {
77 return [... list .filter (i => i .toLowerCase ().includes (query .toLowerCase ())), query ]
88}
99
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+
1015const userList = [
1116 { id: ' 1' , name: ' Tom' , value: ' 123' },
1217 { id: ' 2' , name: ' Tim' , value: ' 124' },
@@ -22,6 +27,17 @@ const schema
2227 dropdown: true ,
2328 label: ' Basic AutoComplete - Use [h]ello' ,
2429 },
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+ },
2541 {
2642 $formkit: ' primeAutoComplete' ,
2743 id: ' basic' ,
0 commit comments