unplugin / unplugin-vue-components

📲 On-demand components auto importing for Vue
https://www.npmjs.com/package/unplugin-vue-components
MIT License
3.77k stars 349 forks source link

按需加载情况下,vue组件component :is 无法识别组件 #642

Open dazed-daydreamer opened 1 year ago

dazed-daydreamer commented 1 year ago

Clear and concise description of the problem

我情况的开发环境是vue3 + vite,在按需加载情况下 <component :is="'ElInput'"></component> 无法试别出element-ui里面的el-input组件,现在我的解决方法有2个是 1.在Main.ts里面重新注册一次 2.重新封装一个custom-input组件

Suggested solution

能在做到直接在component :is="ElInput" 就能识别并渲染el-input组件呢?不需要去main.ts再注册一次全局组件

Alternative

No response

Additional context

No response

Validations

lishaobos commented 1 year ago

你好,兄弟,这个优化暂时被驳回了,参考这个:https://github.com/antfu/unplugin-vue-components/issues/643#issuecomment-1588951920

UphkcRNqmafQWcSSSSSS commented 1 year ago

自己import不就好了?

voyageh commented 1 year ago

看这个#694,该插件是识别_resolveComponent('xxx') 的xxx来帮你自动import的,要是单引号和下划线都不能少

nigiwen commented 9 months ago

这种非常用的组件注册成全局组件也挺好

MrXiaoChuan commented 1 week ago

和unplugin-vue-components不兼得。全靠预测哪些组件会被component :is需要,便全局注册。只有不被需要的才能按需加载