primevue-mirror/apps/showcase/doc/dialog/TemplateDoc.vue

141 lines
6.0 KiB
Vue
Raw Normal View History

<template>
<DocSectionText v-bind="$attrs">
2023-10-29 19:34:22 +00:00
<p>Header and Footer sections allow customization via templating.</p>
</DocSectionText>
2024-05-20 12:14:38 +00:00
<div class="card flex justify-center">
2024-01-23 22:25:44 +00:00
<Button label="Show" @click="visible = true" />
2024-01-23 22:25:44 +00:00
<Dialog v-model:visible="visible" modal header="Edit Profile" :style="{ width: '25rem' }">
2023-10-29 19:34:22 +00:00
<template #header>
2024-05-20 12:14:38 +00:00
<div class="inline-flex items-center justify-center gap-2">
2023-10-29 19:34:22 +00:00
<Avatar image="https://primefaces.org/cdn/primevue/images/avatar/amyelsner.png" shape="circle" />
2024-05-20 12:14:38 +00:00
<span class="font-bold whitespace-nowrap">Amy Elsner</span>
</div>
</template>
2024-05-20 12:14:38 +00:00
<span class="text-surface-500 dark:text-surface-400 block mb-8">Update your information.</span>
<div class="flex items-center gap-4 mb-4">
<label for="username" class="font-semibold w-24">Username</label>
2024-01-23 22:25:44 +00:00
<InputText id="username" class="flex-auto" autocomplete="off" />
</div>
2024-05-20 12:14:38 +00:00
<div class="flex items-center gap-4 mb-2">
<label for="email" class="font-semibold w-24">Email</label>
2024-02-13 13:05:25 +00:00
<InputText id="email" class="flex-auto" autocomplete="off" />
2024-01-23 22:25:44 +00:00
</div>
2023-10-29 19:34:22 +00:00
<template #footer>
2024-01-30 12:02:00 +00:00
<Button label="Cancel" text severity="secondary" @click="visible = false" autofocus />
<Button label="Save" outlined severity="secondary" @click="visible = false" autofocus />
2023-10-29 19:34:22 +00:00
</template>
</Dialog>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
visible: false,
code: {
2023-09-22 12:54:14 +00:00
basic: `
2024-01-23 22:25:44 +00:00
<Button label="Show" @click="visible = true" />
2024-01-23 22:25:44 +00:00
<Dialog v-model:visible="visible" modal header="Edit Profile" :style="{ width: '25rem' }">
2023-10-29 19:34:22 +00:00
<template #header>
2024-05-20 12:14:38 +00:00
<div class="inline-flex items-center justify-center gap-2">
2023-10-29 19:34:22 +00:00
<Avatar image="https://primefaces.org/cdn/primevue/images/avatar/amyelsner.png" shape="circle" />
2024-05-20 12:14:38 +00:00
<span class="font-bold whitespace-nowrap">Amy Elsner</span>
</div>
</template>
2024-05-20 12:14:38 +00:00
<span class="text-surface-500 dark:text-surface-400 block mb-8">Update your information.</span>
<div class="flex items-center gap-4 mb-4">
<label for="username" class="font-semibold w-24">Username</label>
2024-01-23 22:25:44 +00:00
<InputText id="username" class="flex-auto" autocomplete="off" />
</div>
2024-05-20 12:14:38 +00:00
<div class="flex items-center gap-4 mb-2">
<label for="email" class="font-semibold w-24">Email</label>
2024-02-13 13:05:25 +00:00
<InputText id="email" class="flex-auto" autocomplete="off" />
2024-01-23 22:25:44 +00:00
</div>
2023-10-29 19:34:22 +00:00
<template #footer>
2024-01-30 12:02:00 +00:00
<Button label="Cancel" text severity="secondary" @click="visible = false" autofocus />
<Button label="Save" outlined severity="secondary" @click="visible = false" autofocus />
2023-10-29 19:34:22 +00:00
</template>
2023-10-15 09:38:39 +00:00
</Dialog>
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2024-05-20 12:14:38 +00:00
<div class="card flex justify-center">
2024-01-23 22:25:44 +00:00
<Button label="Show" @click="visible = true" />
<Dialog v-model:visible="visible" modal header="Edit Profile" :style="{ width: '25rem' }">
2023-10-29 19:34:22 +00:00
<template #header>
2024-05-20 12:14:38 +00:00
<div class="inline-flex items-center justify-center gap-2">
2023-10-29 19:34:22 +00:00
<Avatar image="https://primefaces.org/cdn/primevue/images/avatar/amyelsner.png" shape="circle" />
2024-05-20 12:14:38 +00:00
<span class="font-bold whitespace-nowrap">Amy Elsner</span>
</div>
</template>
2024-05-20 12:14:38 +00:00
<span class="text-surface-500 dark:text-surface-400 block mb-8">Update your information.</span>
<div class="flex items-center gap-4 mb-4">
<label for="username" class="font-semibold w-24">Username</label>
2024-01-23 22:25:44 +00:00
<InputText id="username" class="flex-auto" autocomplete="off" />
</div>
2024-05-20 12:14:38 +00:00
<div class="flex items-center gap-4 mb-2">
<label for="email" class="font-semibold w-24">Email</label>
2024-02-13 13:05:25 +00:00
<InputText id="email" class="flex-auto" autocomplete="off" />
2024-01-23 22:25:44 +00:00
</div>
2023-10-29 19:34:22 +00:00
<template #footer>
2024-01-30 12:02:00 +00:00
<Button label="Cancel" text severity="secondary" @click="visible = false" autofocus />
<Button label="Save" outlined severity="secondary" @click="visible = false" autofocus />
2023-10-29 19:34:22 +00:00
</template>
</Dialog>
</div>
</template>
<script>
export default {
data() {
return {
visible: false
};
}
};
2023-10-15 09:38:39 +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">
2024-01-23 22:25:44 +00:00
<Button label="Show" @click="visible = true" />
<Dialog v-model:visible="visible" modal header="Edit Profile" :style="{ width: '25rem' }">
2023-10-29 19:34:22 +00:00
<template #header>
2024-05-20 12:14:38 +00:00
<div class="inline-flex items-center justify-center gap-2">
2023-10-29 19:34:22 +00:00
<Avatar image="https://primefaces.org/cdn/primevue/images/avatar/amyelsner.png" shape="circle" />
2024-05-20 12:14:38 +00:00
<span class="font-bold whitespace-nowrap">Amy Elsner</span>
</div>
</template>
2024-05-20 12:14:38 +00:00
<span class="text-surface-500 dark:text-surface-400 block mb-8">Update your information.</span>
<div class="flex items-center gap-4 mb-4">
<label for="username" class="font-semibold w-24">Username</label>
2024-01-23 22:25:44 +00:00
<InputText id="username" class="flex-auto" autocomplete="off" />
</div>
2024-05-20 12:14:38 +00:00
<div class="flex items-center gap-4 mb-2">
<label for="email" class="font-semibold w-24">Email</label>
2024-02-13 13:05:25 +00:00
<InputText id="email" class="flex-auto" autocomplete="off" />
2024-01-23 22:25:44 +00:00
</div>
2023-10-29 19:34:22 +00:00
<template #footer>
2024-01-30 12:02:00 +00:00
<Button label="Cancel" text severity="secondary" @click="visible = false" autofocus />
<Button label="Save" outlined severity="secondary" @click="visible = false" autofocus />
2023-10-29 19:34:22 +00:00
</template>
</Dialog>
</div>
</template>
<script setup>
import { ref } from "vue";
const visible = ref(false);
2023-10-15 09:38:39 +00:00
<\/script>
`
}
};
}
};
</script>