-
-
Notifications
You must be signed in to change notification settings - Fork 145
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
使用auto import之后,如何for循环使用。 #199
Comments
动态加载菜单 icon 时,我也遇到同样的问题 |
此问题解决了吗,我也遇到这个了 |
不能这么用。。。。。 |
how to resolve it? |
@so1ve 请问有什么解决方案吗,比如动态菜单的图标 |
#5 这里的方式我都试过了,里面还是不能动态使用 icon。 |
这个不需要autoimport吧?可以动态传icon prop的 |
@so1ve 我的意思是 |
那就全局注册一个组件吧,看一下vue文档 |
@so1ve 全局注册后 不知道他还是不是按需的 import { Icon } from '@iconify/vue';
app.component('Icon', Icon) |
不是按需的,全局可用 但是问题不大 |
@so1ve 我担心的是全局注册 |
Close as #5. |
这个我不清楚,你可以看看它的文档 我记得是会的 |
可以使用unplugin-vue-components/vite的自定义解析器来实现Icon组件的自动引入 Components({
dirs: ['src/views', 'src/components'],
resolvers: [
// 自动导入 Element Plus 组件
ElementPlusResolver(),
// 自动引入图标组件
IconsResolver({
customCollections: [
'my-icons',
]
}),
//自定义解析器: 用于自动引入Icon组件
(componentName) => {
if (componentName === 'Icon')
return { name: componentName, from: '@iconify/vue' }
},
],
}), |
這個好像可行! |
package.json
vite.config.ts
vue
是生效的。
没有作为组件起作用。
想请教一下,auto import之后,for循环应该怎么实现?
The text was updated successfully, but these errors were encountered: