fix: treeNode customTitle cannot get selected prop

* Tree组件中,treeNode配置scopedSlots: {title: 'customeTitle' },无法获取title插槽的slot-scope值

需要定制tree的title时,具体的值在treeNode的数据上,但现在无法获取title处的插槽参数。经过查看ant-design-vue源码,发现TreeNode.jsx文件在title处配置错误,希望能尽快修复

* Update TreeNode.jsx
pull/2112/head
cubemoon 2020-04-17 18:27:51 +08:00 committed by GitHub
parent 1112f2f791
commit 32f669bd48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -420,7 +420,7 @@ const TreeNode = {
vcTree: { prefixCls, showIcon, icon: treeIcon, draggable, loadData },
} = this;
const disabled = this.isDisabled();
const title = getComponentFromProp(this, 'title') || defaultTitle;
const title = getComponentFromProp(this, 'title', {}, false);
const wrapClass = `${prefixCls}-node-content-wrapper`;
// Icon - Still show loading icon when loading without showIcon
@ -439,9 +439,15 @@ const TreeNode = {
$icon = this.renderIcon();
}
// Title
const $title = <span class={`${prefixCls}-title`}>{title}</span>;
const currentTitle = title;
let $title = currentTitle ? (
<span class={`${prefixCls}-title`}>
{typeof currentTitle === 'function' ? currentTitle({ ...this.$props }, h) : currentTitle}
</span>
) : (
<span class={`${prefixCls}-title`}>{defaultTitle}</span>
);
return (
<span
key="selector"