primevue-mirror/doc/dialog/TemplateDoc.vue

141 lines
6.0 KiB
Vue

<template>
<DocSectionText v-bind="$attrs">
<p>Header and Footer sections allow customization via templating.</p>
</DocSectionText>
<div class="card flex justify-content-center">
<Button label="Show" @click="visible = true" />
<Dialog v-model:visible="visible" modal header="Edit Profile" :style="{ width: '25rem' }">
<template #header>
<div class="inline-flex align-items-center justify-content-center gap-2">
<Avatar image="https://primefaces.org/cdn/primevue/images/avatar/amyelsner.png" shape="circle" />
<span class="font-bold white-space-nowrap">Amy Elsner</span>
</div>
</template>
<span class="p-text-secondary block mb-5">Update your information.</span>
<div class="flex align-items-center gap-3 mb-3">
<label for="username" class="font-semibold w-6rem">Username</label>
<InputText id="username" class="flex-auto" autocomplete="off" />
</div>
<div class="flex align-items-center gap-3 mb-2">
<label for="email" class="font-semibold w-6rem">Email</label>
<InputText id="Email" class="flex-auto" autocomplete="off" />
</div>
<template #footer>
<Button label="Cancel" text severity="secondary" @click="visible = false" autofocus />
<Button label="Save" outlined severity="secondary" @click="visible = false" autofocus />
</template>
</Dialog>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
visible: false,
code: {
basic: `
<Button label="Show" @click="visible = true" />
<Dialog v-model:visible="visible" modal header="Edit Profile" :style="{ width: '25rem' }">
<template #header>
<div class="inline-flex align-items-center justify-content-center gap-2">
<Avatar image="https://primefaces.org/cdn/primevue/images/avatar/amyelsner.png" shape="circle" />
<span class="font-bold white-space-nowrap">Amy Elsner</span>
</div>
</template>
<span class="p-text-secondary block mb-5">Update your information.</span>
<div class="flex align-items-center gap-3 mb-3">
<label for="username" class="font-semibold w-6rem">Username</label>
<InputText id="username" class="flex-auto" autocomplete="off" />
</div>
<div class="flex align-items-center gap-3 mb-2">
<label for="email" class="font-semibold w-6rem">Email</label>
<InputText id="Email" class="flex-auto" autocomplete="off" />
</div>
<template #footer>
<Button label="Cancel" text severity="secondary" @click="visible = false" autofocus />
<Button label="Save" outlined severity="secondary" @click="visible = false" autofocus />
</template>
</Dialog>
`,
options: `
<template>
<div class="card flex justify-content-center">
<Button label="Show" @click="visible = true" />
<Dialog v-model:visible="visible" modal header="Edit Profile" :style="{ width: '25rem' }">
<template #header>
<div class="inline-flex align-items-center justify-content-center gap-2">
<Avatar image="https://primefaces.org/cdn/primevue/images/avatar/amyelsner.png" shape="circle" />
<span class="font-bold white-space-nowrap">Amy Elsner</span>
</div>
</template>
<span class="p-text-secondary block mb-5">Update your information.</span>
<div class="flex align-items-center gap-3 mb-3">
<label for="username" class="font-semibold w-6rem">Username</label>
<InputText id="username" class="flex-auto" autocomplete="off" />
</div>
<div class="flex align-items-center gap-3 mb-2">
<label for="email" class="font-semibold w-6rem">Email</label>
<InputText id="Email" class="flex-auto" autocomplete="off" />
</div>
<template #footer>
<Button label="Cancel" text severity="secondary" @click="visible = false" autofocus />
<Button label="Save" outlined severity="secondary" @click="visible = false" autofocus />
</template>
</Dialog>
</div>
</template>
<script>
export default {
data() {
return {
visible: false
};
}
};
<\/script>
`,
composition: `
<template>
<div class="card flex justify-content-center">
<Button label="Show" @click="visible = true" />
<Dialog v-model:visible="visible" modal header="Edit Profile" :style="{ width: '25rem' }">
<template #header>
<div class="inline-flex align-items-center justify-content-center gap-2">
<Avatar image="https://primefaces.org/cdn/primevue/images/avatar/amyelsner.png" shape="circle" />
<span class="font-bold white-space-nowrap">Amy Elsner</span>
</div>
</template>
<span class="p-text-secondary block mb-5">Update your information.</span>
<div class="flex align-items-center gap-3 mb-3">
<label for="username" class="font-semibold w-6rem">Username</label>
<InputText id="username" class="flex-auto" autocomplete="off" />
</div>
<div class="flex align-items-center gap-3 mb-2">
<label for="email" class="font-semibold w-6rem">Email</label>
<InputText id="Email" class="flex-auto" autocomplete="off" />
</div>
<template #footer>
<Button label="Cancel" text severity="secondary" @click="visible = false" autofocus />
<Button label="Save" outlined severity="secondary" @click="visible = false" autofocus />
</template>
</Dialog>
</div>
</template>
<script setup>
import { ref } from "vue";
const visible = ref(false);
<\/script>
`
}
};
}
};
</script>