ant-design-vue icon indicating copy to clipboard operation
ant-design-vue copied to clipboard

Typography 排版 组件使用时 同时设置 copyable 跟 ellipsis 会出现警告 Slot "default" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.

Open archiesong opened this issue 1 year ago • 4 comments
trafficstars

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Version

4.1.0

Environment

vue 3.4.23

Reproduction link

https://www.antdv.com/components/typography-cn#api

Steps to reproduce

在项目中使用Typography 组件 <TypographyText :ellipsis="{ tooltip: '提示123232'}" :copyable="{ tooltip: false, text: '1232'}" content="ASD大苏打实打实大苏打实打实大苏打实打实的AS" />

What is expected?

浏览器控制台没有 Vue Warn 警告 提示

What is actually happening?

[Vue warn]: Slot "default" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead. at <ATooltip key="copy" title="" > at <App>

QQ截图20240505030728 QQ截图20240505030752

archiesong avatar May 04 '24 19:05 archiesong

同样遇到了,请问解决了吗

Jiachenglong2518 avatar May 23 '24 09:05 Jiachenglong2518

image 检查Typography 组件 源码 发现在onMounted生命周期里面调用了 syncEllipsis 方法 这个方法中使用了slots 所以会报这个警告,注释掉这个方法就不会有警告, 而且功能正常,希望作者能在下个版本更新能修复这个问题

archiesong avatar May 29 '24 03:05 archiesong

能提供一些复现的代码吗?

cc-hearts avatar Jun 18 '24 15:06 cc-hearts

image 这样使用 @cc-hearts

archiesong avatar Jun 21 '24 09:06 archiesong

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Aug 21 '24 02:08 github-actions[bot]