primevue-mirror/apps/showcase/doc/autocomplete/SizesDoc.vue

86 lines
2.7 KiB
Vue
Raw Normal View History

2024-10-25 20:13:22 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>AutoComplete provides <i>small</i> and <i>large</i> sizes as alternatives to the base.</p>
</DocSectionText>
<div class="card flex flex-col items-center gap-4">
2024-10-26 10:41:04 +00:00
<AutoComplete v-model="value1" :suggestions="items" @complete="search" size="small" placeholder="Small" dropdown />
<AutoComplete v-model="value2" :suggestions="items" @complete="search" placeholder="Normal" dropdown />
<AutoComplete v-model="value3" :suggestions="items" @complete="search" size="large" placeholder="Large" dropdown />
2024-10-25 20:13:22 +00:00
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
2024-10-26 10:41:04 +00:00
value1: null,
value2: null,
value3: null,
items: [],
2024-10-25 20:13:22 +00:00
code: {
basic: `
2024-10-26 10:41:04 +00:00
<AutoComplete v-model="value1" :suggestions="items" @complete="search" size="small" placeholder="Small" dropdown />
<AutoComplete v-model="value2" :suggestions="items" @complete="search" placeholder="Normal" dropdown />
<AutoComplete v-model="value3" :suggestions="items" @complete="search" size="large" placeholder="Large" dropdown />
2024-10-25 20:13:22 +00:00
`,
options: `
<template>
<div class="card flex flex-col items-center gap-4">
2024-10-26 10:41:04 +00:00
<AutoComplete v-model="value1" :suggestions="items" @complete="search" size="small" placeholder="Small" dropdown />
<AutoComplete v-model="value2" :suggestions="items" @complete="search" placeholder="Normal" dropdown />
<AutoComplete v-model="value3" :suggestions="items" @complete="search" size="large" placeholder="Large" dropdown />
2024-10-25 20:13:22 +00:00
</div>
</template>
<script>
export default {
data() {
return {
2024-10-26 10:41:04 +00:00
value1: null,
value2: null,
value3: null,
items: [],
2024-10-25 20:13:22 +00:00
};
},
methods: {
2024-10-26 10:41:04 +00:00
search() {
this.items = [];
2024-10-25 20:13:22 +00:00
}
}
};
<\/script>
`,
composition: `
<template>
<div class="card flex flex-col items-center gap-4">
2024-10-26 10:41:04 +00:00
<AutoComplete v-model="value1" :suggestions="items" @complete="search" size="small" placeholder="Small" dropdown />
<AutoComplete v-model="value2" :suggestions="items" @complete="search" placeholder="Normal" dropdown />
<AutoComplete v-model="value3" :suggestions="items" @complete="search" size="large" placeholder="Large" dropdown />
2024-10-25 20:13:22 +00:00
</div>
</template>
<script setup>
import { ref } from "vue";
2024-10-26 10:41:04 +00:00
const value1 = ref(null);
const value2 = ref(null);
const value3 = ref(null);
const items = ref([]);
2024-10-25 20:13:22 +00:00
2024-10-26 10:41:04 +00:00
const search = () => {
items.value = [];
2024-10-25 20:13:22 +00:00
}
<\/script>
`
}
};
},
methods: {
2024-10-26 10:41:04 +00:00
search() {
this.items = [];
2024-10-25 20:13:22 +00:00
}
}
};
</script>