Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug report] description row slot problem #21285

Closed
bukeliyuchenmou opened this issue Sep 2, 2021 · 3 comments · Fixed by #21462
Closed

[bug report] description row slot problem #21285

bukeliyuchenmou opened this issue Sep 2, 2021 · 3 comments · Fixed by #21462

Comments

@bukeliyuchenmou
Copy link

Element UI version

2.15.5

OS/Browsers version

mac big sur 11.5.2 / Google Chrome 92.0.4515.159

Vue version

2.6.14

Reproduction Link

https://codepen.io/bukeliyuchenmou/pen/YzQqgjp

Steps to reproduce

<el-descriptions-item >
                               <div {...{
                                   slot: "label"
                               }}>
                                   121213123
                               </div>
                               {this.list_data[i].create_at_str}
                           </el-descriptions-item>

What is Expected?

我期望他的slot能够出现

What is actually happening?

没有出现,我阅读完源码后,发现,作者已经把row这个的propsslotlabel 都过滤完毕了,记录成了一个 label ,但是在默认的流程控制中,他却使用了 item.props.label , 这样的话如果不是有边框的描述列表和垂直排列的描述列表,他们的el-descriptions-item slot都用不了啦

@element-bot element-bot changed the title [Bug Report] descriptions-row slot插槽的问题 [bug report] description row slot problem Sep 2, 2021
@element-bot
Copy link
Member

Translation of this issue:

Element UI version

2.15.5

OS/Browsers version

mac big sur 11.5.2 / Google Chrome 92.0.4515.159

Vue version

2.6.14

Reproduction Link

https://codepen.io/bukeliyuchenmou/pen/YzQqgjp

Steps to reproduce

<el-descriptions-item >
<div {...{

slot: \"label\"
}}>

one hundred and twenty-one million two hundred and thirteen thousand one hundred and twenty-three
</div>

{this.list_ data[i].create_ at_ str}
</el-descriptions-item>

What is Expected?

I expect his slot to appear

What is actually happening?

No, after reading the source code, I found that the author has filtered the 'props' of row and the' label 'of' slot 'and recorded them as a' label ', but in the default process control, he uses' item. Props. Label'. In this case, if it is not a description list with a border and a description list arranged vertically, Their El descriptions item slots are useless

@zhuxianbin
Copy link

zhuxianbin commented Sep 4, 2021

手动打补丁
在 node_modules\element-ui\lib\descriptions.js 文件中,修改111行,追加为以下代码

if (!item.slots.label) {
    item.slots.label = item.vnode.data.scopedSlots && item.vnode.data.scopedSlots.label();
}

@ufologist
Copy link

在使用 Descriptions Item label slot 时, 只有设置 Descriptions 带边框时才会生效

<el-descriptions border>

重现示例
https://codepen.io/ufologist/pen/GRvPOZv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants