|
@@ -0,0 +1,35 @@
|
|
|
+<template>
|
|
|
+ <el-tree :data="data" lazy node-key="id">
|
|
|
+ <span slot-scope="{ node, data }">
|
|
|
+ <span>{{ data.name }}</span>
|
|
|
+ <span>
|
|
|
+ <el-button type="text" size="mini" @click="append(node,data)">新增</el-button>
|
|
|
+ <el-button type="text" size="mini" @click="replace(node, data)">修改</el-button>
|
|
|
+ <el-button type="text" size="mini" @click="remove(node, data)">删除</el-button>
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+ </el-tree>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { getTreeDemoData } from "@/api/treeDemo";
|
|
|
+export default {
|
|
|
+ name: "tree_demo",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ data: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ getTreeDemoData().then(res => {
|
|
|
+ console.log(res);
|
|
|
+ this.data = res.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ append: function(node, data) {},
|
|
|
+ replace: function(node, data) {},
|
|
|
+ remove: function(node, data) {}
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|