Template demo added

pull/6537/head
tugcekucukoglu 2024-10-02 14:09:40 +03:00
parent 61901aeed8
commit 822c4d6500
2 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,70 @@
<template>
<DocSectionText v-bind="$attrs">
<p>Custom content for icon is displayed with the handle slot that takes an check state as a parameter.</p>
</DocSectionText>
<div class="card flex justify-center">
<ToggleSwitch v-model="checked">
<template #handle="{ checked }">
<i :class="checked ? 'pi pi-check' : 'pi pi-times'" />
</template>
</ToggleSwitch>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
checked: false,
code: {
basic: `
<ToggleSwitch v-model="checked">
<template #handle="{ checked }">
<i :class="checked ? 'pi pi-check' : 'pi pi-times'" />
</template>
</ToggleSwitch>
`,
options: `
<template>
<div class="card flex justify-center">
<ToggleSwitch v-model="checked">
<template #handle="{ checked }">
<i :class="checked ? 'pi pi-check' : 'pi pi-times'" />
</template>
</ToggleSwitch>
</div>
</template>
<script>
export default {
data() {
return {
checked: false
}
}
};
<\/script>
`,
composition: `
<template>
<div class="card flex justify-center">
<ToggleSwitch v-model="checked">
<template #handle="{ checked }">
<i :class="checked ? 'pi pi-check' : 'pi pi-times'" />
</template>
</ToggleSwitch>
</div>
</template>
<script setup>
import { ref } from 'vue';
const checked = ref(false);
<\/script>
`
}
};
}
};
</script>

View File

@ -9,6 +9,7 @@ import DisabledDoc from '@/doc/toggleswitch/DisabledDoc.vue';
import ImportDoc from '@/doc/toggleswitch/ImportDoc.vue';
import InvalidDoc from '@/doc/toggleswitch/InvalidDoc.vue';
import PreselectionDoc from '@/doc/toggleswitch/PreselectionDoc.vue';
import TemplateDoc from '@/doc/toggleswitch/TemplateDoc.vue';
import PTComponent from '@/doc/toggleswitch/pt/index.vue';
import ThemingDoc from '@/doc/toggleswitch/theming/index.vue';
@ -36,6 +37,11 @@ export default {
label: 'Invalid',
component: InvalidDoc
},
{
id: 'template',
label: 'Template',
component: TemplateDoc
},
{
id: 'disabled',
label: 'Disabled',