primevue-mirror/doc/breadcrumb/TemplateDoc.vue

77 lines
2.4 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>Custom content can be placed inside the menuitem using the <i>item</i> templating.</p>
</DocSectionText>
<div class="card flex justify-content-center">
<Breadcrumb :home="home" :model="items">
<template #item="{ item }">
<a :class="item.class" :href="item.url">
<span :class="item.icon"></span>
</a>
</template>
</Breadcrumb>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
2023-03-02 08:32:40 +00:00
home: { icon: 'pi pi-home', url: 'https://primevue.org/' },
2023-02-28 08:29:30 +00:00
items: [{ icon: 'pi pi-sitemap' }, { icon: 'pi pi-book' }, { icon: 'pi pi-wallet' }, { icon: 'pi pi-shopping-bag' }, { icon: 'pi pi-calculator' }],
code: {
2023-08-16 13:58:31 +00:00
basic: `<Breadcrumb :home="home" :model="items">
2023-02-28 08:29:30 +00:00
<template #item="item">
<a :class="item.class">
<span :class="item.icon"></span>
</a>
</template>
</Breadcrumb>`,
2023-08-16 13:58:31 +00:00
options: `<template>
2023-02-28 08:29:30 +00:00
<div class="card flex justify-content-center">
<Breadcrumb :home="home" :model="items">
<template #item="{item}">
<a :class="item.class">
<span :class="item.icon"></span>
</a>
</template>
</Breadcrumb>
</div>
</template>
<script>
export default {
data() {
return {
2023-03-02 08:32:40 +00:00
home: { icon: 'pi pi-home', url: 'https://primevue.org/' },
2023-02-28 08:29:30 +00:00
items: [{ icon: 'pi pi-sitemap' }, { icon: 'pi pi-book' }, { icon: 'pi pi-wallet' }, { icon: 'pi pi-shopping-bag' }, { icon: 'pi pi-calculator' }]
}
}
}
<\/script>`,
2023-08-16 13:58:31 +00:00
composition: `<template>
2023-02-28 08:29:30 +00:00
<div class="card flex justify-content-center">
<Breadcrumb :home="home" :model="items">
<template #item="{item}">
<a :class="item.class">
<span :class="item.icon"></span>
</a>
</template>
</Breadcrumb>
</div>
</template>
<script setup>
import { ref } from "vue";
2023-03-02 08:32:40 +00:00
const home = ref({ icon: 'pi pi-home', url: 'https://primevue.org/' });
2023-02-28 08:29:30 +00:00
const items = ref([{ icon: 'pi pi-sitemap' }, { icon: 'pi pi-book' }, { icon: 'pi pi-wallet' }, { icon: 'pi pi-shopping-bag' }, { icon: 'pi pi-calculator' }]);
}
<\/script>`
}
};
}
};
</script>