提交 d63c8a3b 编写于 作者: T tinyu

Wed Mar 27 09:12:00 CST 2024 inscode

上级 ff445e46
<template> <template>
<div> <div>
<el-tree :data="data" :default-checked-keys="selectedKeys" show-checkbox default-expand-all node-key="id" ref="tree" highlight-current <el-tree :data="data" :default-checked-keys="selectedKeys" show-checkbox default-expand-all node-key="id" ref="tree"
:props="defaultProps"> highlight-current :props="defaultProps">
</el-tree> </el-tree>
<div class="buttons"> <div class="buttons">
<el-button @click="getCheckedKeys">提交</el-button> <el-button @click="getCheckedKeys">提交</el-button>
...@@ -13,17 +13,24 @@ ...@@ -13,17 +13,24 @@
</div> </div>
</template> </template>
<script> <script>
export default { export default {
methods: { methods: {
getCheckedKeys() { getCheckedKeys() {
const keys = this.$refs.tree.getCheckedKeys(true) const keys = this.$refs.tree.getCheckedKeys(true)
this.selectedKeys=keys this.selectedKeys = keys
console.log(keys); console.log(keys);
}, },
}, },
mounted() {
console.log(getNodeRoute(this.data, { id: 9 }))
},
data() { data() {
return { return {
selectedKeys:[9], selectedKeys: [9, 8],
data: [{ data: [{
id: 1, id: 1,
label: '一级 1', label: '一级 1',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册