chromatic-lattice/src/components/features/tree/Tree.vue

67 lines
1.5 KiB
Vue
Raw Normal View History

2022-01-14 04:25:47 +00:00
<template>
<span class="row" v-for="(row, index) in nodes" :key="index">
2022-01-25 04:25:34 +00:00
<TreeNode
v-for="(node, nodeIndex) in row"
:key="nodeIndex"
v-bind="node"
:force-tooltip="node.forceTooltip"
/>
2022-01-14 04:25:47 +00:00
</span>
<span class="left-side-nodes" v-if="leftSideNodes">
<TreeNode
v-for="(node, nodeIndex) in leftSideNodes"
:key="nodeIndex"
2022-01-25 04:25:34 +00:00
v-bind="node"
:force-tooltip="node.forceTooltip"
2022-01-14 04:25:47 +00:00
small
/>
</span>
<span class="side-nodes" v-if="rightSideNodes">
<TreeNode
v-for="(node, nodeIndex) in rightSideNodes"
:key="nodeIndex"
2022-01-25 04:25:34 +00:00
v-bind="node"
:force-tooltip="node.forceTooltip"
2022-01-14 04:25:47 +00:00
small
/>
</span>
</template>
2022-01-25 04:23:30 +00:00
<script lang="ts">
2022-01-25 04:25:34 +00:00
import { GenericTreeNode } from "@/features/tree";
import { defineComponent, PropType } from "vue";
2022-01-14 04:25:47 +00:00
import TreeNode from "./TreeNode.vue";
2022-01-25 04:25:34 +00:00
export default defineComponent({
props: {
nodes: {
type: Array as PropType<GenericTreeNode[][]>,
required: true
},
leftSideNodes: Array as PropType<GenericTreeNode[]>,
rightSideNodes: Array as PropType<GenericTreeNode[]>
},
setup() {
return { TreeNode };
}
2022-01-25 04:23:30 +00:00
});
2022-01-14 04:25:47 +00:00
</script>
<style scoped>
.row {
margin: 50px auto;
}
.left-side-nodes {
position: absolute;
left: 15px;
top: 65px;
}
.side-nodes {
position: absolute;
right: 15px;
top: 65px;
}
</style>