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

refactor(menu): component optimization #5073

Closed

Conversation

zhangpaopao0609
Copy link
Collaborator

🤔 这个 PR 的性质是?

  • 重构

🔗 相关 Issue

#5047

📝 更新日志

  • refactor(menu): component optimization

  • 本条 PR 不需要纳入 Changelog

Copy link
Contributor

github-actions bot commented Feb 23, 2025

失败

@zhangpaopao0609
Copy link
Collaborator Author

zhangpaopao0609 commented Feb 24, 2025

这里的错误应该是 hooks 对同名的 props 和 slot 处理的优先级问题,从目前的结果看,是 slot 优先了,这里要排查一下
image

image

@zhangpaopao0609
Copy link
Collaborator Author

zhangpaopao0609 commented Feb 24, 2025

排查发现是这里写错了,这里应该返回 boolean 才对,但这里默认返回的是一个空对象,也就是 true

// packages/components/utils/render-tnode.ts getSlotFirst
image

// packages/components/hooks/tnode.ts useTNodeJSX
因此导致这里默认为 true,那么这里就是 slots 优先了

image

@uyarn
Copy link
Collaborator

uyarn commented Feb 25, 2025

是的 props优先

Copy link

pkg-pr-new bot commented Feb 26, 2025

Open in Stackblitz

npm i https://pkg.pr.new/tdesign-vue-next@5073

commit: 9ed3eb7

@zhangpaopao0609
Copy link
Collaborator Author

zhangpaopao0609 commented Feb 26, 2025

又发现一个 bug
image
这里有默认的 count,但 count 还支持 slot,有默认值还支持个 der 呀
image

更有趣的是,这里的单测一直都是过的,当然,这是因为之前的 slotFirst bug 导致的
image

@zhangpaopao0609 zhangpaopao0609 force-pushed the feature/paopao/component-optimization-menu branch from d82c7d1 to 9ed3eb7 Compare February 26, 2025 09:17
@uyarn uyarn deleted the feature/paopao/component-optimization-menu branch February 26, 2025 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants