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

Icon不显示问题 #343

Closed
luajoy opened this issue Jul 31, 2017 · 4 comments
Closed

Icon不显示问题 #343

luajoy opened this issue Jul 31, 2017 · 4 comments

Comments

@luajoy
Copy link

luajoy commented Jul 31, 2017

dva项目使用antd-mobile,引用src/assets/中的svg图标的时候,会报错:

Icon props.type is invalid, have you set svg-sprite-loader correctly? see https://goo.gl/kN8oiw

引入svg-sprite-loader后还是报这个错。
dva项目需要怎么配置svg-sprite-loader?如何正确使用svg图标?谢谢

@sorrycc
Copy link
Owner

sorrycc commented Jul 31, 2017

@luajoy
Copy link
Author

luajoy commented Jul 31, 2017

@sorrycc 按照文档在dva项目中创建.roadhogrc.js文件并配置svg图标路径,但是引用svg图标的时候还是报错,我的引用是:

<Item key="4" value="scan" icon={<Icon type={require('../assets/icons/scan.svg')} size="xs" />

<Icon type="check" />

刚学习dva,水平很差,麻烦前辈了,谢谢

@luajoy luajoy changed the title svg报错 Icon不显示问题 Jul 31, 2017
@luajoy
Copy link
Author

luajoy commented Jul 31, 2017

问题同 #345

@yourVictor
Copy link

在项目下安装svg-sprite-loader@0.3.1即可解决问题;

项目的pacage.json相关部分代码如下:

"antd-mobile": "^1.6.3",
"roadhog": "^1.3.4",
"svg-sprite-loader": "^0.3.1"

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

3 participants