forked from hug-sun/element3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(Tree): Migration Project Folder
- Loading branch information
Showing
2 changed files
with
163 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,169 @@ | ||
<template> | ||
<el-radio-group v-model="tabPosition" style="margin-bottom: 30px"> | ||
<el-radio-button label="top">top</el-radio-button> | ||
<el-radio-button label="right">right</el-radio-button> | ||
<el-radio-button label="bottom">bottom</el-radio-button> | ||
<el-radio-button label="left">left</el-radio-button> | ||
</el-radio-group> | ||
|
||
<el-tabs :tab-position="tabPosition" style="height: 200px"> | ||
<el-tab-pane label="用户管理">用户管理</el-tab-pane> | ||
<el-tab-pane label="配置管理">配置管理</el-tab-pane> | ||
<el-tab-pane label="角色管理">角色管理</el-tab-pane> | ||
<el-tab-pane label="定时任务补偿">定时任务补偿</el-tab-pane> | ||
</el-tabs> | ||
<el-tree v-model="nodes.value"></el-tree> | ||
</template> | ||
|
||
<script> | ||
import { defineComponent } from 'vue' | ||
export default defineComponent({ | ||
data() { | ||
import { getCurrentInstance, reactive, ref } from 'vue' | ||
export default { | ||
// data() { | ||
// return { | ||
// data: [ | ||
// { | ||
// label: '一级 1', | ||
// children: [ | ||
// { | ||
// label: '二级 1-1', | ||
// children: [ | ||
// { | ||
// label: '三级 1-1-1' | ||
// } | ||
// ] | ||
// } | ||
// ] | ||
// }, | ||
// { | ||
// label: '一级 2', | ||
// children: [ | ||
// { | ||
// label: '二级 2-1', | ||
// children: [ | ||
// { | ||
// label: '三级 2-1-1' | ||
// } | ||
// ] | ||
// }, | ||
// { | ||
// label: '二级 2-2', | ||
// children: [ | ||
// { | ||
// label: '三级 2-2-1' | ||
// } | ||
// ] | ||
// } | ||
// ] | ||
// }, | ||
// { | ||
// label: '一级 3', | ||
// children: [ | ||
// { | ||
// label: '二级 3-1', | ||
// children: [ | ||
// { | ||
// label: '三级 3-1-1' | ||
// } | ||
// ] | ||
// }, | ||
// { | ||
// label: '二级 3-2', | ||
// children: [ | ||
// { | ||
// label: '三级 3-2-1' | ||
// } | ||
// ] | ||
// } | ||
// ] | ||
// } | ||
// ], | ||
// defaultProps: { | ||
// children: 'children', | ||
// label: 'label' | ||
// } | ||
// } | ||
// }, | ||
// methods: { | ||
// handleNodeClick(data) { | ||
// console.log(data) | ||
// } | ||
// }, | ||
// mounted() { | ||
// setTimeout(() => { | ||
// this.data.push({ | ||
// label: 'Hello' | ||
// }) | ||
// }, 1000) | ||
// }, | ||
setup() { | ||
const vm = getCurrentInstance().proxy | ||
function reft(v) { | ||
return { | ||
value: v | ||
} | ||
} | ||
const nodes = reft([ | ||
{ | ||
label: '一级 1', | ||
children: [ | ||
{ | ||
label: '二级 1-1', | ||
children: [ | ||
{ | ||
label: '三级 1-1-1' | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
label: '一级 2', | ||
children: [ | ||
{ | ||
label: '二级 2-1', | ||
children: [ | ||
{ | ||
label: '三级 2-1-1' | ||
} | ||
] | ||
}, | ||
{ | ||
label: '二级 2-2', | ||
children: [ | ||
{ | ||
label: '三级 2-2-1' | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
label: '一级 3', | ||
children: [ | ||
{ | ||
label: '二级 3-1', | ||
children: [ | ||
{ | ||
label: '三级 3-1-1' | ||
} | ||
] | ||
}, | ||
{ | ||
label: '二级 3-2', | ||
children: [ | ||
{ | ||
label: '三级 3-2-1' | ||
} | ||
] | ||
} | ||
] | ||
} | ||
]) | ||
setTimeout(() => { | ||
console.log(nodes, vm.nodes) | ||
nodes.value[0].label = 'TTT' | ||
nodes.value[0].children[0].label = 'TTT' | ||
nodes.value.push({ | ||
label: 'Hello' | ||
}) | ||
nodes.value[0].children.push({ | ||
label: 'Hello' | ||
}) | ||
}, 3000) | ||
return { | ||
tabPosition: 'top' | ||
nodes | ||
} | ||
} | ||
}) | ||
} | ||
</script> |