-
-
Notifications
You must be signed in to change notification settings - Fork 361
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
当组件名和自定义指令名重名时无法正常使用该指令(Vite+Vue3+ElementPlus) #364
Comments
Please provide a minimum reproduction repo. |
我也遇到了同样的问题,我看看能不能提供个最小成本复现吧 |
https://github.com/hooray/unplugin-vue-components-directives |
感谢提供,我最近比较忙,没注意到回复,你提供的代码没问题,感谢感谢! |
是否有必要添加一个directives的目录的配置项,来搜索里面自定义指令函数并引入,类似unplugin-auto-import。 |
问题描述
当components目录下有Auth.vue组件,同时又自定义了auth指令时,Auth组件能正常使用,但v-auth指令将不生效。
必须在directives选项为true或使用ElementPlusResolver时才能复现。
期望效果
Auth组件正常使用、v-auth指令也能正常使用
解决建议
在查看源代码后,发现可能的原因是:解析组件和解析指令方法用的是同一个map对象,导致先解析到Auth组件并缓存,再解析auth指令时直接使用了缓存。是否可以额外使用一个map对象缓存解析到的指令呢?或是其他更好的解决方式?
部分截图
The text was updated successfully, but these errors were encountered: