2023-02-28 08:29:30 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs">
|
|
|
|
<p>Multiple mode is enabled using <i>multiple</i> property used to select more than one value from the autocomplete. In this case, value reference should be an array.</p>
|
|
|
|
</DocSectionText>
|
|
|
|
<div class="card p-fluid">
|
2024-05-25 13:59:06 +00:00
|
|
|
<label for="multiple-ac-1" class="font-bold mb-2 block">With Typeahead</label>
|
|
|
|
<AutoComplete v-model="value1" inputId="multiple-ac-1" multiple :suggestions="items" @complete="search" />
|
|
|
|
|
|
|
|
<label for="multiple-ac-2" class="font-bold mt-8 mb-2 block">Without Typeahead</label>
|
|
|
|
<AutoComplete v-model="value2" inputId="multiple-ac-2" multiple @complete="search" :typeahead="false" />
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
<DocSectionCode :code="code" />
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2024-05-25 13:59:06 +00:00
|
|
|
value1: null,
|
|
|
|
value2: null,
|
2023-02-28 08:29:30 +00:00
|
|
|
items: [],
|
|
|
|
code: {
|
2023-09-22 12:54:14 +00:00
|
|
|
basic: `
|
2024-05-25 13:59:06 +00:00
|
|
|
<label for="multiple-ac-1" class="font-bold mb-2 block">With Typeahead</label>
|
|
|
|
<AutoComplete v-model="value1" inputId="multiple-ac-1" multiple :suggestions="items" @complete="search" />
|
|
|
|
|
|
|
|
<label for="multiple-ac-2" class="font-bold mt-8 mb-2 block">Without Typeahead</label>
|
|
|
|
<AutoComplete v-model="value2" inputId="multiple-ac-2" multiple @complete="search" :typeahead="false" />
|
2023-10-15 09:38:39 +00:00
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
options: `
|
|
|
|
<template>
|
2023-02-28 08:29:30 +00:00
|
|
|
<div class="card p-fluid">
|
2024-05-25 13:59:06 +00:00
|
|
|
<label for="multiple-ac-1" class="font-bold mb-2 block">With Typeahead</label>
|
|
|
|
<AutoComplete v-model="value1" inputId="multiple-ac-1" multiple :suggestions="items" @complete="search" />
|
|
|
|
|
|
|
|
<label for="multiple-ac-2" class="font-bold mt-8 mb-2 block">Without Typeahead</label>
|
|
|
|
<AutoComplete v-model="value2" inputId="multiple-ac-2" multiple @complete="search" :typeahead="false" />
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2024-05-25 13:59:06 +00:00
|
|
|
value1: null,
|
|
|
|
value2: null,
|
2023-02-28 08:29:30 +00:00
|
|
|
items: []
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
search(event) {
|
|
|
|
this.items = [...Array(10).keys()].map((item) => event.query + '-' + item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2023-10-15 09:38:39 +00:00
|
|
|
<\/script>
|
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
composition: `
|
|
|
|
<template>
|
2023-02-28 08:29:30 +00:00
|
|
|
<div class="card p-fluid">
|
2024-05-25 13:59:06 +00:00
|
|
|
<label for="multiple-ac-1" class="font-bold mb-2 block">With Typeahead</label>
|
|
|
|
<AutoComplete v-model="value1" inputId="multiple-ac-1" multiple :suggestions="items" @complete="search" />
|
|
|
|
|
|
|
|
<label for="multiple-ac-2" class="font-bold mt-8 mb-2 block">Without Typeahead</label>
|
|
|
|
<AutoComplete v-model="value2" inputId="multiple-ac-2" multiple @complete="search" :typeahead="false" />
|
2023-02-28 08:29:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { ref } from "vue";
|
|
|
|
|
2024-05-25 13:59:06 +00:00
|
|
|
const value1 = ref(null);
|
|
|
|
const value2 = ref(null);
|
2023-02-28 08:29:30 +00:00
|
|
|
const items = ref([]);
|
|
|
|
|
|
|
|
const search = (event) => {
|
|
|
|
items.value = [...Array(10).keys()].map((item) => event.query + '-' + item);
|
|
|
|
}
|
2023-10-15 09:38:39 +00:00
|
|
|
<\/script>
|
|
|
|
`
|
2023-02-28 08:29:30 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
search(event) {
|
|
|
|
this.items = [...Array(10).keys()].map((item) => event.query + '-' + item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|