Appearance
dft-model-tree
结构树使用虚拟滚动实现
使用提示
tree 组件需要配合 model-view 组件使用,单独使用没有数据。
vue
<template>
<div style="width: 100vw; height: 100vh; display: flex">
<dft-model-tree></dft-model-tree>
<dft-model-view
:sceneConstructor="DFTCore.Scene"
:scene-options="sceneOptions"
></dft-model-view>
</div>
</template>
<script setup>
import { reactive } from "vue";
import DFTCore from "dft-vision-core-es6.min.js";
const sceneOptions = reactive({
// 数据源,默认 DFTCore.OFFLINE
dataType: DFTCore.OFFLINE,
// 文件路径
url: "/pdv/1004",
});
</script>
vue
<template>
<div style="width: 100vw; height: 100vh; display: flex">
<dft-model-tree></dft-model-tree>
<dft-model-view
:sceneConstructor="DFTCore.Scene"
:scene-options="sceneOptions"
></dft-model-view>
</div>
</template>
<script>
import DFTCore from "dft-vision-core-es6.min.js";
export default {
data() {
return {
sceneOptions: {
// 数据源,默认 DFTCore.OFFLINE
dataType: DFTCore.OFFLINE,
// 文件路径
url: "/pdv/1004",
// 资源文件夹地址
},
DFTCore,
};
},
};
</script>
分组
默认所有的 vision 组件都是联动的, 可以使用 props.symbol 进行分组联动
vue
<template>
<div style="width: 100vw; height: 100vh; display: flex">
<dft-model-tree symbol="theKey"></dft-model-tree>
<dft-model-view
symbol="theKey"
:sceneConstructor="DFTCore.Scene"
:scene-options="sceneOptions"
></dft-model-view>
</div>
<div style="width: 100vw; height: 100vh; display: flex">
<dft-model-tree></dft-model-tree>
<dft-model-view
:sceneConstructor="DFTCore.Scene"
:scene-options="sceneOptions"
></dft-model-view>
</div>
</template>
<script setup lang="ts">
import { reactive } from "vue";
import DFTCore from "dft-vision-core-es6.min.js";
const sceneOptions = reactive({
// 数据源,默认 DFTCore.OFFLINE
dataType: DFTCore.OFFLINE,
// 文件路径
url: "/pdv/1004",
});
</script>
vue
<template>
<div style="width: 100vw; height: 100vh; display: flex">
<dft-model-tree symbol="theKey"></dft-model-tree>
<dft-model-view
symbol="theKey"
:sceneConstructor="DFTCore.Scene"
:scene-options="sceneOptions"
></dft-model-view>
</div>
<div style="width: 100vw; height: 100vh; display: flex">
<dft-model-tree></dft-model-tree>
<dft-model-view
:sceneConstructor="DFTCore.Scene"
:scene-options="sceneOptions"
></dft-model-view>
</div>
</template>
<script>
import DFTCore from "dft-vision-core-es6.min.js";
export default {
data() {
return {
sceneOptions: {
// 数据源,默认 DFTCore.OFFLINE
dataType: DFTCore.OFFLINE,
// 文件路径
url: "/pdv/1004",
// 资源文件夹地址
},
DFTCore,
};
},
};
</script>
Props
props | 说明 | 类型 | 默认值 |
---|---|---|---|
symbol | 分组标识, 同组内组件产生联动交互, 默认所有组件在同一个组 | string|symbol | |
getContextMenus | 右键菜单, 返回数据 | (defaultContextMenus: ContextMenu[], { node }) => ContextMenu[] | |
expandedKeys(v-model) | 展开的节点 keys | string[] | [] |
defaultExpandedKeys | 默认展开的节点 keys | string[] | [] |
itemSize | 树节点高度 | number | 36 |
leftSpace | 左侧层级间距 | number | 16 |
Exposed
名称 | 说明 | 方法参数 | 方法返回 |
---|---|---|---|
scrollTo | 定位到节点 | (nodeId: string) => void |