mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-24 10:33:50 +08:00
fix(BasicTree): not inherit slot and not show icon slot. close #1902
This commit is contained in:
parent
7b87d6d29e
commit
a0b2a9e949
@ -393,16 +393,26 @@
|
||||
) : (
|
||||
title
|
||||
);
|
||||
|
||||
const iconDom = icon ? (
|
||||
<TreeIcon icon={icon} />
|
||||
) : slots.icon ? (
|
||||
<span class="mr-1">{getSlot(slots, 'icon')}</span>
|
||||
) : null;
|
||||
|
||||
item[titleField] = (
|
||||
<span
|
||||
class={`${bem('title')} pl-2`}
|
||||
onClick={handleClickNode.bind(null, item[keyField], item[childrenField])}
|
||||
>
|
||||
{slots?.title ? (
|
||||
getSlot(slots, 'title', item)
|
||||
<>
|
||||
{iconDom}
|
||||
{getSlot(slots, 'title', item)}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{icon && <TreeIcon icon={icon} />}
|
||||
{iconDom}
|
||||
{titleDom}
|
||||
<span class={bem('actions')}>{renderAction(item)}</span>
|
||||
</>
|
||||
@ -444,7 +454,9 @@
|
||||
tip="加载中..."
|
||||
>
|
||||
<ScrollContainer style={scrollStyle} v-show={!unref(getNotFound)}>
|
||||
<Tree {...unref(getBindValues)} showIcon={false} treeData={treeData.value} />
|
||||
<Tree {...unref(getBindValues)} showIcon={false} treeData={treeData.value}>
|
||||
{extendSlots(slots, ['title'])}
|
||||
</Tree>
|
||||
</ScrollContainer>
|
||||
<Empty
|
||||
v-show={unref(getNotFound)}
|
||||
|
@ -3,7 +3,7 @@ import { h } from 'vue';
|
||||
import { isString } from 'lodash-es';
|
||||
import Icon from '@/components/Icon/Icon.vue';
|
||||
|
||||
export const TreeIcon = ({ icon }: { icon: VNode | string }) => {
|
||||
export const TreeIcon = ({ icon }: { icon: VNode | string | undefined }) => {
|
||||
if (!icon) return null;
|
||||
if (isString(icon)) {
|
||||
return h(Icon, { icon, class: 'mr-1' });
|
||||
|
Loading…
Reference in New Issue
Block a user