primevue-mirror/apps/showcase/doc/dock/BasicDoc.vue

257 lines
7.1 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
2023-11-04 10:04:07 +00:00
<p>Menu requires a collection of menuitems as its <i>model</i> and an <i>icon</i> template. Default location is <i>bottom</i> and other edges are also available when defined with the <i>position</i> property.</p>
2023-02-28 08:29:30 +00:00
</DocSectionText>
<div class="card dock-demo">
2024-05-20 12:14:38 +00:00
<div class="flex flex-wrap gap-4 mb-8">
<div v-for="pos of positions" :key="pos.label" class="flex items-center">
2023-02-28 08:29:30 +00:00
<RadioButton v-model="position" :value="pos.value" :inputId="pos.label" name="dock" />
<label :for="pos.label" class="ml-2"> {{ pos.label }} </label>
</div>
</div>
<div class="dock-window" style="backgroundimage: 'url(https://primefaces.org/cdn/primevue/images/dock/window.jpg)'">
<Dock :model="items" :position="position">
2024-05-06 10:32:40 +00:00
<template #itemicon="{ item }">
2023-02-28 08:29:30 +00:00
<img :alt="item.label" :src="item.icon" style="width: 100%" />
</template>
</Dock>
</div>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
items: [
{
label: 'Finder',
2023-03-20 07:52:29 +00:00
icon: 'https://primefaces.org/cdn/primevue/images/dock/finder.svg'
2023-02-28 08:29:30 +00:00
},
{
label: 'App Store',
2023-03-20 07:52:29 +00:00
icon: 'https://primefaces.org/cdn/primevue/images/dock/appstore.svg'
2023-02-28 08:29:30 +00:00
},
{
label: 'Photos',
2023-03-20 07:52:29 +00:00
icon: 'https://primefaces.org/cdn/primevue/images/dock/photos.svg'
2023-02-28 08:29:30 +00:00
},
{
label: 'Trash',
2023-03-20 07:52:29 +00:00
icon: 'https://primefaces.org/cdn/primevue/images/dock/trash.png'
2023-02-28 08:29:30 +00:00
}
],
position: 'bottom',
positions: [
{
label: 'Bottom',
value: 'bottom'
},
{
label: 'Top',
value: 'top'
},
{
label: 'Left',
value: 'left'
},
{
label: 'Right',
value: 'right'
}
],
code: {
2023-09-22 12:54:14 +00:00
basic: `
<Dock :model="items" :position="position">
2024-05-06 10:32:40 +00:00
<template #itemicon="{ item }">
2023-02-28 08:29:30 +00:00
<img :alt="item.label" :src="item.icon" style="width: 100%" />
</template>
2023-10-15 09:38:39 +00:00
</Dock>
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2023-02-28 08:29:30 +00:00
<div class="card dock-demo">
2024-05-20 12:14:38 +00:00
<div class="flex flex-wrap gap-4 mb-8">
<div v-for="pos of positions" :key="pos.label" class="flex items-center">
2023-02-28 08:29:30 +00:00
<RadioButton v-model="position" :value="pos.value" :inputId="pos.label" name="dock" />
<label :for="pos.label" class="ml-2"> {{ pos.label }} </label>
</div>
</div>
<div class="dock-window">
<Dock :model="items" :position="position">
2024-05-06 10:32:40 +00:00
<template #itemicon="{ item }">
2023-02-28 08:29:30 +00:00
<img :alt="item.label" :src="item.icon" style="width: 100%" />
</template>
</Dock>
</div>
</div>
</template>
<script>
export default {
data() {
return {
items: [
{
label: 'Finder',
icon: 'https://primefaces.org/cdn/primevue/images/dock/finder.svg'
},
{
label: 'App Store',
icon: 'https://primefaces.org/cdn/primevue/images/dock/appstore.svg'
},
{
label: 'Photos',
icon: 'https://primefaces.org/cdn/primevue/images/dock/photos.svg'
},
{
label: 'Trash',
icon: 'https://primefaces.org/cdn/primevue/images/dock/trash.png'
}
],
position: 'bottom',
positions: [
{
label: 'Bottom',
value: 'bottom'
},
{
label: 'Top',
value: 'top'
},
{
label: 'Left',
value: 'left'
},
{
label: 'Right',
value: 'right'
}
]
}
}
}
<\/script>
<style scoped>
.dock-demo > .dock-window {
width: 100%;
height: 450px;
position: relative;
background-image: url("https://primefaces.org/cdn/primevue/images/dock/window.jpg");
background-repeat: no-repeat;
background-size: cover;
z-index: 1;
}
.dock-demo > .p-dock {
z-index: 1000;
}
2023-10-15 09:38:39 +00:00
</style>
`,
2023-09-22 12:54:14 +00:00
composition: `
<template>
2023-02-28 08:29:30 +00:00
<div class="card dock-demo">
2024-05-20 12:14:38 +00:00
<div class="flex flex-wrap gap-4 mb-8">
<div v-for="pos of positions" :key="pos.label" class="flex items-center">
2023-02-28 08:29:30 +00:00
<RadioButton v-model="position" :value="pos.value" :inputId="pos.label" name="dock" />
<label :for="pos.label" class="ml-2"> {{ pos.label }} </label>
</div>
</div>
<div class="dock-window" style="backgroundimage: 'url(https://primefaces.org/cdn/primevue/images/dock/window.jpg))'">
<Dock :model="items" :position="position">
2024-05-06 10:32:40 +00:00
<template #itemicon="{ item }">
2023-02-28 08:29:30 +00:00
<img :alt="item.label" :src="item.icon" style="width: 100%" />
</template>
</Dock>
</div>
</div>
</template>
<script setup>
import { ref } from "vue";
const items = ref([
{
label: 'Finder',
icon: 'https://primefaces.org/cdn/primevue/images/dock/finder.svg'
},
{
label: 'App Store',
icon: 'https://primefaces.org/cdn/primevue/images/dock/appstore.svg'
},
{
label: 'Photos',
icon: 'https://primefaces.org/cdn/primevue/images/dock/photos.svg'
},
{
label: 'Trash',
icon: 'https://primefaces.org/cdn/primevue/images/dock/trash.png'
}
]);
const position = ref('bottom');
const positions = ref([
{
label: 'Bottom',
value: 'bottom'
},
{
label: 'Top',
value: 'top'
},
{
label: 'Left',
value: 'left'
},
{
label: 'Right',
value: 'right'
}
]);
<\/script>
<style scoped>
.dock-demo > .dock-window {
width: 100%;
height: 450px;
position: relative;
background-image: url("https://primefaces.org/cdn/primevue/images/dock/window.jpg");
background-repeat: no-repeat;
background-size: cover;
z-index: 1;
}
.dock-demo > .p-dock {
z-index: 1000;
}
2023-11-01 14:36:59 +00:00
</style>
`
2023-02-28 08:29:30 +00:00
}
};
}
};
</script>
<style scoped>
.dock-demo > .dock-window {
width: 100%;
height: 450px;
position: relative;
background-image: url('https://primefaces.org/cdn/primevue/images/dock/window.jpg');
background-repeat: no-repeat;
background-size: cover;
z-index: 1;
}
.dock-demo > .p-dock {
z-index: 1000;
}
.dock-demo .p-menubar {
padding: 0;
border-radius: 0;
}
</style>