Skip to content

Commit 6a949e6

Browse files
committed
feat(demo): add another AutoComplete sample with async complete function and new props (fluid, placeholder, minLength)
1 parent 52cf18a commit 6a949e6

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

dev/pages/inputs/AutoComplete.vue

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
<script setup lang='ts'>
2-
const primeAttributes = 'placeholder, separator, allowDuplicate, max, addOnBlur'
2+
const primeAttributes = 'placeholder, multiple, typeahead, optionLabel, size, minLength, fluid'
33
44
const list = ['Hello', 'Hero', 'House', 'World']
55
66
function 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+
1015
const 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

Comments
 (0)