feat(components): [tree] support customize content when data is empty (#12459)

This commit is contained in:
Lov`u`e 2023-04-17 14:06:34 +08:00 committed by GitHub
parent c0b8f4751b
commit 5cd6d61400
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -198,5 +198,6 @@ tree/draggable
## Slots
| Name | Description |
| ---- | ---------------------------------------------------------------------- |
| ----- | ---------------------------------------------------------------------- |
| — | Custom content for tree nodes. The scope parameter is `{ node, data }` |
| empty | empty you can customize content when data is empty. |

View File

@ -22,9 +22,11 @@
@node-expand="handleNodeExpand"
/>
<div v-if="isEmpty" :class="ns.e('empty-block')">
<span :class="ns.e('empty-text')">{{
emptyText ?? t('el.tree.emptyText')
}}</span>
<slot name="empty">
<span :class="ns.e('empty-text')">
{{ emptyText ?? t('el.tree.emptyText') }}
</span>
</slot>
</div>
<div
v-show="dragState.showDropIndicator"