2021-03-18 18:30:10 +08:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
|
2021-03-19 10:00:41 +08:00
|
|
|
<el-tree :data="datas" :props="defaultProps" @node-click="handleNodeClick">
|
|
|
|
<span slot-scope="{ data }" class="custom-tree-node">
|
|
|
|
<span>
|
|
|
|
<span v-if="!!data.id">
|
|
|
|
<el-button
|
|
|
|
icon="el-icon-picture-outline"
|
|
|
|
type="text"
|
|
|
|
/>
|
|
|
|
</span>
|
|
|
|
<span style="margin-left: 6px">{{ data.name }}</span>
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</el-tree>
|
2021-03-18 18:30:10 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { loadTree } from '@/api/panel/share'
|
|
|
|
export default {
|
|
|
|
name: 'ShareTree',
|
|
|
|
data() {
|
|
|
|
return {
|
2021-03-19 10:00:41 +08:00
|
|
|
datas: [],
|
2021-03-18 18:30:10 +08:00
|
|
|
defaultProps: {
|
|
|
|
children: 'children',
|
|
|
|
label: 'name'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.initData()
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
initData() {
|
|
|
|
const param = {}
|
|
|
|
loadTree(param).then(res => {
|
2021-03-19 10:00:41 +08:00
|
|
|
this.datas = res.data
|
2021-03-18 18:30:10 +08:00
|
|
|
})
|
|
|
|
},
|
|
|
|
handleNodeClick(data) {
|
|
|
|
console.log(data)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|