2023-02-28 08:29:30 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs">
|
|
|
|
<p>Tree is used to display hierarchical data.</p>
|
|
|
|
</DocSectionText>
|
|
|
|
<div class="card flex justify-content-center">
|
|
|
|
<Tree :value="nodes" class="w-full md:w-30rem">
|
|
|
|
<template #default="slotProps">
|
|
|
|
<b>{{ slotProps.node.label }}</b>
|
|
|
|
</template>
|
|
|
|
<template #url="slotProps">
|
|
|
|
<a :href="slotProps.node.data">{{ slotProps.node.label }}</a>
|
|
|
|
</template>
|
|
|
|
</Tree>
|
|
|
|
</div>
|
|
|
|
<DocSectionCode :code="code" />
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
nodes: [
|
|
|
|
{
|
|
|
|
key: '0',
|
|
|
|
label: 'Introduction',
|
|
|
|
children: [
|
|
|
|
{ key: '0-0', label: 'What is Vue.js?', data: 'https://vuejs.org/guide/introduction.html#what-is-vue', type: 'url' },
|
|
|
|
{ key: '0-1', label: 'Quick Start', data: 'https://vuejs.org/guide/quick-start.html#quick-start', type: 'url' },
|
|
|
|
{ key: '0-2', label: 'Creating a Vue Application', data: 'https://vuejs.org/guide/essentials/application.html#creating-a-vue-application', type: 'url' },
|
|
|
|
{ key: '0-3', label: 'Conditionals Rendering', data: 'https://vuejs.org/guide/essentials/conditional.html#conditional-rendering', type: 'url' }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: '1',
|
|
|
|
label: 'Components In-Depth',
|
|
|
|
children: [
|
|
|
|
{ key: '1-0', label: 'Component Registration', data: 'https://vuejs.org/guide/components/registration.html#component-registration', type: 'url' },
|
|
|
|
{ key: '1-1', label: 'Props', data: 'https://vuejs.org/guide/components/props.html#props', type: 'url' },
|
|
|
|
{ key: '1-2', label: 'Components Events', data: 'https://vuejs.org/guide/components/events.html#component-events', type: 'url' },
|
|
|
|
{ key: '1-3', label: 'Slots', data: 'https://vuejs.org/guide/components/slots.html#slots', type: 'url' }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
code: {
|
2023-09-22 12:54:14 +00:00
|
|
|
basic: `
|
|
|
|
<Tree :value="nodes" class="w-full md:w-30rem">
|
2023-02-28 08:29:30 +00:00
|
|
|
<template #default="slotProps">
|
|
|
|
<b>{{ slotProps.node.label }}</b>
|
|
|
|
</template>
|
|
|
|
<template #url="slotProps">
|
|
|
|
<a :href="slotProps.node.data">{{ slotProps.node.label }}</a>
|
|
|
|
</template>
|
|
|
|
</Tree>`,
|
2023-09-22 12:54:14 +00:00
|
|
|
options: `
|
|
|
|
<template>
|
2023-02-28 08:29:30 +00:00
|
|
|
<div class="card flex justify-content-center">
|
|
|
|
<Tree :value="nodes" class="w-full md:w-30rem">
|
|
|
|
<template #default="slotProps">
|
|
|
|
<b>{{ slotProps.node.label }}</b>
|
|
|
|
</template>
|
|
|
|
<template #url="slotProps">
|
|
|
|
<a :href="slotProps.node.data">{{ slotProps.node.label }}</a>
|
|
|
|
</template>
|
|
|
|
</Tree>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
nodes: [
|
|
|
|
{
|
|
|
|
key: '0',
|
|
|
|
label: 'Introduction',
|
|
|
|
children: [
|
|
|
|
{ key: '0-0', label: 'What is Vue.js?', data: 'https://vuejs.org/guide/introduction.html#what-is-vue', type: 'url' },
|
|
|
|
{ key: '0-1', label: 'Quick Start', data: 'https://vuejs.org/guide/quick-start.html#quick-start', type: 'url' },
|
|
|
|
{ key: '0-2', label: 'Creating a Vue Application', data: 'https://vuejs.org/guide/essentials/application.html#creating-a-vue-application', type: 'url' },
|
|
|
|
{ key: '0-3', label: 'Conditionals Rendering', data: 'https://vuejs.org/guide/essentials/conditional.html#conditional-rendering', type: 'url' }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: '1',
|
|
|
|
label: 'Components In-Depth',
|
|
|
|
children: [
|
|
|
|
{ key: '1-0', label: 'Component Registration', data: 'https://vuejs.org/guide/components/registration.html#component-registration', type: 'url' },
|
|
|
|
{ key: '1-1', label: 'Props', data: 'https://vuejs.org/guide/components/props.html#props', type: 'url' },
|
|
|
|
{ key: '1-2', label: 'Components Events', data: 'https://vuejs.org/guide/components/events.html#component-events', type: 'url' },
|
|
|
|
{ key: '1-3', label: 'Slots', data: 'https://vuejs.org/guide/components/slots.html#slots', type: 'url' }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
<\/script>`,
|
2023-09-22 12:54:14 +00:00
|
|
|
composition: `
|
|
|
|
<template>
|
2023-02-28 08:29:30 +00:00
|
|
|
<div class="card flex justify-content-center">
|
|
|
|
<Tree :value="nodes" class="w-full md:w-30rem">
|
|
|
|
<template #default="slotProps">
|
|
|
|
<b>{{ slotProps.node.label }}</b>
|
|
|
|
</template>
|
|
|
|
<template #url="slotProps">
|
|
|
|
<a :href="slotProps.node.data">{{ slotProps.node.label }}</a>
|
|
|
|
</template>
|
|
|
|
</Tree>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { ref } from 'vue';
|
|
|
|
|
|
|
|
const nodes = ref([
|
|
|
|
{
|
|
|
|
key: '0',
|
|
|
|
label: 'Introduction',
|
|
|
|
children: [
|
|
|
|
{ key: '0-0', label: 'What is Vue.js?', data: 'https://vuejs.org/guide/introduction.html#what-is-vue', type: 'url' },
|
|
|
|
{ key: '0-1', label: 'Quick Start', data: 'https://vuejs.org/guide/quick-start.html#quick-start', type: 'url' },
|
|
|
|
{ key: '0-2', label: 'Creating a Vue Application', data: 'https://vuejs.org/guide/essentials/application.html#creating-a-vue-application', type: 'url' },
|
|
|
|
{ key: '0-3', label: 'Conditionals Rendering', data: 'https://vuejs.org/guide/essentials/conditional.html#conditional-rendering', type: 'url' }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: '1',
|
|
|
|
label: 'Components In-Depth',
|
|
|
|
children: [
|
|
|
|
{ key: '1-0', label: 'Component Registration', data: 'https://vuejs.org/guide/components/registration.html#component-registration', type: 'url' },
|
|
|
|
{ key: '1-1', label: 'Props', data: 'https://vuejs.org/guide/components/props.html#props', type: 'url' },
|
|
|
|
{ key: '1-2', label: 'Components Events', data: 'https://vuejs.org/guide/components/events.html#component-events', type: 'url' },
|
|
|
|
{ key: '1-3', label: 'Slots', data: 'https://vuejs.org/guide/components/slots.html#slots', type: 'url' }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]);
|
2023-03-13 10:57:47 +00:00
|
|
|
<\/script>`,
|
|
|
|
data: `
|
|
|
|
{
|
|
|
|
key: '0',
|
|
|
|
label: 'Documents',
|
|
|
|
data: 'Documents Folder',
|
|
|
|
icon: 'pi pi-fw pi-inbox',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
key: '0-0',
|
|
|
|
label: 'Work',
|
|
|
|
data: 'Work Folder',
|
|
|
|
icon: 'pi pi-fw pi-cog',
|
|
|
|
children: [
|
|
|
|
{ key: '0-0-0', label: 'Expenses.doc', icon: 'pi pi-fw pi-file', data: 'Expenses Document' },
|
|
|
|
{ key: '0-0-1', label: 'Resume.doc', icon: 'pi pi-fw pi-file', data: 'Resume Document' }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: '0-1',
|
|
|
|
label: 'Home',
|
|
|
|
data: 'Home Folder',
|
|
|
|
icon: 'pi pi-fw pi-home',
|
|
|
|
children: [{ key: '0-1-0', label: 'Invoices.txt', icon: 'pi pi-fw pi-file', data: 'Invoices for this month' }]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
...`
|
2023-02-28 08:29:30 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|