element-tree-line el-tree 添加结构线 添加虚线
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element
免费下载资源
·
概览:给element组件添加上虚线,通过使用插件element-tree-line
参考连接:
安装插件:
# npm
npm install element-tree-line -S# yarn
yarn add element-tree-line -S
main.js全局注册引入插件:
import { getElementLabelLine } from 'element-tree-line';
import 'element-tree-line/dist/style.css';
const ElementLabelLine = getElementLabelLine(h);
app.component(ElementLabelLine.name, ElementLabelLine);
el-tree组件封装:
<template>
<el-tree ref="treeRef" class="tree-content" :data="props.treeData" node-key="id" :highlight-current="true"
:props="props.defaultProps" icon="none" :current-node-key='0' default-expand-all :indent="props.treeIndent">
<template #default="{ node, data }">
<element-tree-line :node="node" :showLabelLine="false" :indent="props.treeIndent">
<template v-slot:node-label>
<div class="com-tree">
<i v-if="data.children?.length > 0"
:class="node.expanded ? 'iconfont icon-pinleijianshao' : 'iconfont icon-pinleizengjia'"
class="tree-icon"></i>
<span class="com-tree-text" @click="nodeClick(data)">{{ node.label }}</span>
</div>
</template>
</element-tree-line>
</template>
</el-tree>
</template>
<script setup>
let props = defineProps({ treeData: Array, defaultProps: Object, treeIndent: Number });
const emits = defineEmits(['nodeClick']);
const nodeClick = (data) => {
emits('nodeClick', data);
};
</script>
el-tree页面组件使用:
<el-scrollbar>
<Tree
:treeData="data.treeData"
:defaultProps="defaultProps"
:treeIndent="data.treeIndent"
@nodeClick="hanleNodeClick">
</Tree>
</el-scrollbar>
效果展示:
GitHub 加速计划 / eleme / element
54.06 K
14.63 K
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:3 个月前 )
c345bb45
7 个月前
a07f3a59
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update table.md
* Update transition.md
* Update popover.md 7 个月前
更多推荐
已为社区贡献9条内容
所有评论(0)