Open uniquejava opened 5 years ago
import SvgIcon from '@/components/SvgIcon'
Vue.component('svg-icon', SvgIcon)
<svg-icon :name="getIconName(req.cat)" class="large" />
<a-avatar size="small" :src="require('@/assets/boy.jpeg')" />
You can't change the color of an image that way. If you load SVG as an image, you can't change how it is displayed using CSS or Javascript in the browser.
If you want to change your SVG image, you have to load it using
原理: https://www.zhangxinxu.com/wordpress/2014/07/introduce-svg-sprite-technology/ 插件: https://github.com/swisnl/vue-cli-plugin-svg-sprite
一键安装
这个命令 会修改如下文件:
详见: https://github.com/swisnl/vue-cli-plugin-svg-sprite