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

fix: 小程序组件自调用时自动添加到usingComponents #4913

Open
wants to merge 13 commits into
base: next
Choose a base branch
from

Conversation

acyza
Copy link

@acyza acyza commented May 19, 2024

一些小程序组件自调用也需要声明usingComponents,而vue组件自调用是不需要导入的

注:组件在没有自动导入如:easycom,情况下才可复现此问题

@Otto-J
Copy link
Member

Otto-J commented May 20, 2024

感谢你的 PR,你可以补充测试用例,或者在评论区补充相关测试场景吗?需要测试哪些场景,比如小程序关闭 easycom,并且某个个组件引用自己。

补充更多复现信息有助于定位和测试你的 PR

@acyza
Copy link
Author

acyza commented May 20, 2024

感谢你的 PR,你可以补充测试用例,或者在评论区补充相关测试场景吗?需要测试哪些场景,比如小程序关闭 easycom,并且某个个组件引用自己。

补充更多复现信息有助于定位和测试你的 PR

https://github.com/acyza/uni-app/tree/pr_1_demo
以这个demo中的tree组件为例,tree组件是符合easycom的,但tree组件中的item组件不符合easycom
item是自调用的组件,在vue里是不需要导入的,因此在h5页面渲染正常
但编译成微信小程序usingComponents里是没有加组件本身的,导致树的子节点并未被渲染出来

h5效果
image

微信小程序效果
image

@Otto-J

@Otto-J Otto-J added 欢迎贡献 PR pr welcome mp mini program labels May 21, 2024
@Otto-J
Copy link
Member

Otto-J commented May 23, 2024

很强!感谢提供测试用例,我来 review 你提供的代码。
我看包含很多 ast 的操作,这块 review 我会和同事共同 review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mp mini program 欢迎贡献 PR pr welcome
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants