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

全局注册组件方式引入注册图标,npm run build 后图标组件未注册,显示不出来 #538

Open
826327700 opened this issue Sep 1, 2022 · 1 comment

Comments

@826327700
Copy link

全局注册组件方式引入图标,在npm run serve模式下 正常使用, 在打包发布后 图标不显示,对应组件在html中渲染为未注册的标签

import {HomeOutlined} from '@ant-design/icons-vue'
export default function installIcons(Vue){
   Vue.component(HomeOutlined.name, HomeOutlined)
}

const app = createApp(App)
app.use(installIcons)

如果改成在页面内引入:

import {HomeOutlined} from '@ant-design/icons-vue'

则打包后也正常显示。

用的是vue3 不知道哪里有问题

@gjf450005950
Copy link

我也遇到了同样的问题,采用这种方式解决的

import {HomeOutlined} from '@ant-design/icons-vue'
export default function installIcons(Vue){
   Vue.component(HomeOutlined.displayName, HomeOutlined)
}

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

No branches or pull requests

2 participants