primevue-mirror/doc/toolbar/BasicDoc.vue

173 lines
5.2 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>Toolbar provides <i>start</i>, <i>center</i> and <i>end</i> properties to place content at these sections.</p>
</DocSectionText>
<div class="card">
<Toolbar>
<template #start>
<Button label="New" icon="pi pi-plus" class="mr-2" />
2023-03-03 12:15:20 +00:00
<Button label="Upload" icon="pi pi-upload" severity="success" />
2023-02-28 08:29:30 +00:00
<i class="pi pi-bars p-toolbar-separator mr-2" />
<SplitButton label="Save" icon="pi pi-check" :model="items" class="p-button-warning"></SplitButton>
</template>
<template #end>
<Button icon="pi pi-search" class="mr-2" />
2023-03-03 12:15:20 +00:00
<Button icon="pi pi-calendar" severity="success" class="mr-2" />
<Button icon="pi pi-times" severity="danger" />
2023-02-28 08:29:30 +00:00
</template>
</Toolbar>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
items: [
{
label: 'Update',
icon: 'pi pi-refresh'
},
{
label: 'Delete',
icon: 'pi pi-times'
},
{
label: 'Vue Website',
icon: 'pi pi-external-link',
command: () => {
window.location.href = 'https://vuejs.org/';
}
},
{
label: 'Upload',
icon: 'pi pi-upload',
command: () => {
this.$router.push('fileupload');
}
}
],
code: {
basic: `
<Toolbar>
<template #start>
<Button label="New" icon="pi pi-plus" class="mr-2" />
2023-03-03 12:15:20 +00:00
<Button label="Upload" icon="pi pi-upload" severity="success" />
2023-02-28 08:29:30 +00:00
<i class="pi pi-bars p-toolbar-separator mr-2" />
<SplitButton label="Save" icon="pi pi-check" :model="items" class="p-button-warning"></SplitButton>
</template>
<template #end>
<Button icon="pi pi-search" class="mr-2" />
2023-03-03 12:15:20 +00:00
<Button icon="pi pi-calendar" severity="success" class="mr-2" />
<Button icon="pi pi-times" severity="danger" />
2023-02-28 08:29:30 +00:00
</template>
</Toolbar>`,
options: `
<template>
<div class="card">
<Toolbar>
<template #start>
<Button label="New" icon="pi pi-plus" class="mr-2" />
2023-03-03 12:15:20 +00:00
<Button label="Upload" icon="pi pi-upload" severity="success" />
2023-02-28 08:29:30 +00:00
<i class="pi pi-bars p-toolbar-separator mr-2" />
<SplitButton label="Save" icon="pi pi-check" :model="items" class="p-button-warning"></SplitButton>
</template>
<template #end>
<Button icon="pi pi-search" class="mr-2" />
2023-03-03 12:15:20 +00:00
<Button icon="pi pi-calendar" severity="success" class="mr-2" />
<Button icon="pi pi-times" severity="danger" />
2023-02-28 08:29:30 +00:00
</template>
</Toolbar>
</div>
</template>
<script>
export default {
data() {
return {
items: [
{
label: 'Update',
icon: 'pi pi-refresh'
},
{
label: 'Delete',
icon: 'pi pi-times'
},
{
label: 'Vue Website',
icon: 'pi pi-external-link',
command: () => {
window.location.href = 'https://vuejs.org/';
}
},
{
label: 'Upload',
icon: 'pi pi-upload',
command: () => {
this.$router.push('fileupload');
}
}
]
};
}
};
<\/script>`,
composition: `
<template>
<div class="card">
<Toolbar>
<template #start>
<Button label="New" icon="pi pi-plus" class="mr-2" />
2023-03-03 12:15:20 +00:00
<Button label="Upload" icon="pi pi-upload" severity="success" />
2023-02-28 08:29:30 +00:00
<i class="pi pi-bars p-toolbar-separator mr-2" />
<SplitButton label="Save" icon="pi pi-check" :model="items" class="p-button-warning"></SplitButton>
</template>
<template #end>
<Button icon="pi pi-search" class="mr-2" />
2023-03-03 12:15:20 +00:00
<Button icon="pi pi-calendar" severity="success" class="mr-2" />
<Button icon="pi pi-times" severity="danger" />
2023-02-28 08:29:30 +00:00
</template>
</Toolbar>
</div>
</template>
<script setup>
import { ref } from 'vue';
const items = ref([
{
label: 'Update',
icon: 'pi pi-refresh'
},
{
label: 'Delete',
icon: 'pi pi-times'
},
{
label: 'Vue Website',
icon: 'pi pi-external-link',
command: () => {
window.location.href = 'https://vuejs.org/';
}
},
{
label: 'Upload',
icon: 'pi pi-upload',
command: () => {
this.$router.push('fileupload');
}
}
])
<\/script>`
}
};
}
};
</script>