2020-03-23 03:00:24 +00:00
|
|
|
<template>
|
2021-08-17 14:03:49 +00:00
|
|
|
<a-tree
|
|
|
|
v-model:expandedKeys="expandedKeys"
|
|
|
|
v-model:selectedKeys="selectedKeys"
|
|
|
|
v-model:checkedKeys="checkedKeys"
|
|
|
|
checkable
|
|
|
|
:tree-data="treeData"
|
|
|
|
>
|
|
|
|
<template #title0010><span style="color: #1890ff">sss</span></template>
|
|
|
|
</a-tree>
|
2020-03-23 03:00:24 +00:00
|
|
|
</template>
|
2021-08-17 14:03:49 +00:00
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent, ref, watch } from 'vue';
|
|
|
|
import { TreeDataItem } from 'ant-design-vue/es/tree/Tree';
|
|
|
|
|
|
|
|
const treeData: TreeDataItem[] = [
|
|
|
|
{
|
|
|
|
title: 'parent 1',
|
|
|
|
key: '0-0',
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
title: 'parent 1-0',
|
|
|
|
key: '0-0-0',
|
|
|
|
disabled: true,
|
|
|
|
children: [
|
|
|
|
{ title: 'leaf', key: '0-0-0-0', disableCheckbox: true },
|
|
|
|
{ title: 'leaf', key: '0-0-0-1' },
|
|
|
|
],
|
2020-11-23 08:39:09 +00:00
|
|
|
},
|
2021-08-17 14:03:49 +00:00
|
|
|
{
|
|
|
|
title: 'parent 1-1',
|
|
|
|
key: '0-0-1',
|
|
|
|
children: [{ key: '0-0-1-0', slots: { title: 'title0010' } }],
|
2020-11-23 08:39:09 +00:00
|
|
|
},
|
2021-08-17 14:03:49 +00:00
|
|
|
],
|
2020-11-23 08:39:09 +00:00
|
|
|
},
|
2021-08-17 14:03:49 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
setup() {
|
|
|
|
const expandedKeys = ref<string[]>(['0-0-0', '0-0-1']);
|
|
|
|
const selectedKeys = ref<string[]>(['0-0-0', '0-0-1']);
|
|
|
|
const checkedKeys = ref<string[]>(['0-0-0', '0-0-1']);
|
|
|
|
watch(expandedKeys, () => {
|
|
|
|
console.log('expandedKeys', expandedKeys);
|
|
|
|
});
|
|
|
|
watch(selectedKeys, () => {
|
|
|
|
console.log('selectedKeys', selectedKeys);
|
|
|
|
});
|
|
|
|
watch(checkedKeys, () => {
|
|
|
|
console.log('checkedKeys', checkedKeys);
|
|
|
|
});
|
|
|
|
|
|
|
|
return {
|
|
|
|
treeData,
|
|
|
|
expandedKeys,
|
|
|
|
selectedKeys,
|
|
|
|
checkedKeys,
|
|
|
|
};
|
2020-11-23 08:39:09 +00:00
|
|
|
},
|
|
|
|
});
|
2020-10-19 09:17:10 +00:00
|
|
|
</script>
|