$ npm install vue-svg-icon --save-dev
跑起来后报错
This dependency was not found:
* !xml-loader!../../src/svg in ./~/.6.4.1@babel-loader/lib!./~/.11.1.4@vue-loader/lib/selector.js?type=script&index=0!./~/.1.2.8@vue-svg-icon/Icon.vue
To install it, you can run: npm install --save !xml-loader!../../src/svg
解决方法:
①在/src同级目录新建svg目录,里面放图标文件。
②在main.js中导入库:
import Icon from "vue-svg-icon/Icon.vue";
// 这一句好像要放在Vue.use和Vue.config.productionTip上面
Vue.component("icon", Icon);
Vue.use(ElementUI);
Vue.config.productionTip = false;
③然后在vue中正常使用就行了
<icon name="github"></icon>