2023-02-28 08:29:30 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs">
|
|
|
|
<p>Checkboxes can be generated using a list of values.</p>
|
|
|
|
</DocSectionText>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="card flex justify-center">
|
|
|
|
<div class="flex flex-col gap-4">
|
|
|
|
<div v-for="category of categories" :key="category.key" class="flex items-center">
|
2023-02-28 08:29:30 +00:00
|
|
|
<Checkbox v-model="selectedCategories" :inputId="category.key" name="category" :value="category.name" />
|
|
|
|
<label :for="category.key" class="ml-2">{{ category.name }}</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<DocSectionCode :code="code" />
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
selectedCategories: ['Marketing'],
|
|
|
|
categories: [
|
|
|
|
{ name: 'Accounting', key: 'A' },
|
|
|
|
{ name: 'Marketing', key: 'M' },
|
|
|
|
{ name: 'Production', key: 'P' },
|
|
|
|
{ name: 'Research', key: 'R' }
|
|
|
|
],
|
|
|
|
code: {
|
2023-09-22 12:54:14 +00:00
|
|
|
basic: `
|
2024-05-20 12:14:38 +00:00
|
|
|
<div v-for="category of categories" :key="category.key" class="flex items-center">
|
2023-02-28 08:29:30 +00:00
|
|
|
<Checkbox v-model="selectedCategories" :inputId="category.key" name="category" :value="category.name" />
|
|
|
|
<label :for="category.key">{{ category.name }}</label>
|
2023-10-15 06:00:52 +00:00
|
|
|
</div>
|
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
options: `
|
|
|
|
<template>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="card flex justify-center">
|
|
|
|
<div class="flex flex-col gap-4">
|
|
|
|
<div v-for="category of categories" :key="category.key" class="flex items-center">
|
2023-02-28 08:29:30 +00:00
|
|
|
<Checkbox v-model="selectedCategories" :inputId="category.key" name="category" :value="category.name" />
|
|
|
|
<label :for="category.key">{{ category.name }}</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
selectedCategories: ['Marketing'],
|
|
|
|
categories: [
|
|
|
|
{ name: "Accounting", key: "A" },
|
|
|
|
{ name: "Marketing", key: "M" },
|
|
|
|
{ name: "Production", key: "P" },
|
|
|
|
{ name: "Research", key: "R" }
|
|
|
|
]
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
2023-10-15 06:00:52 +00:00
|
|
|
<\/script>
|
|
|
|
`,
|
2023-09-22 12:54:14 +00:00
|
|
|
composition: `
|
|
|
|
<template>
|
2024-05-20 12:14:38 +00:00
|
|
|
<div class="card flex justify-center">
|
|
|
|
<div class="flex flex-col gap-4">
|
|
|
|
<div v-for="category of categories" :key="category.key" class="flex items-center">
|
2023-02-28 08:29:30 +00:00
|
|
|
<Checkbox v-model="selectedCategories" :inputId="category.key" name="category" :value="category.name" />
|
|
|
|
<label :for="category.key">{{ category.name }}</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { ref } from "vue";
|
|
|
|
|
|
|
|
const categories = ref([
|
|
|
|
{name: "Accounting", key: "A"},
|
|
|
|
{name: "Marketing", key: "M"},
|
|
|
|
{name: "Production", key: "P"},
|
|
|
|
{name: "Research", key: "R"}
|
|
|
|
]);
|
|
|
|
const selectedCategories = ref(['Marketing']);
|
2023-10-15 06:00:52 +00:00
|
|
|
<\/script>
|
|
|
|
`
|
2023-02-28 08:29:30 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|