本项目是在cenkai88的vue-svg-icon项目上修改的,移除了一些我不需要的功能,props也做了一些修改。请移步vue-svg-icon
npm install vue2-svg-icon --save-dev
- this dir are not supported to be configured now
- src folder should be in the same folder with node_modules
import Icon from 'vue2-svg-icon/Icon.vue';
Vue.component('icon', Icon);
- name: svg file name
- w: width (accept String or Number)
- h: height (accept String or Nnmber)
<icon name="chameleon" :w="24" :h="24"></icon>
- cannot find corresponding .svg file in vue2-svg-icon/svg when you inject it in main.js, please keep the name in main.js and the filename exactly same.
[Vue warn]: Invalid prop: custom validator check failed for prop "name".
- cannot find the "svg" fold in src folder
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@vue2-svg-icon/Icon.vue
To install it, you can run: npm install --save !xml-loader!../../src/svg
- pls check the .babelrc file of root folder
Module build failed: ReferenceError: Unknown plugin "transform-runtime"
specified in "/Users/test/Desktop/Dev/github/.babelrc" at 0, attempted to resolve relative to
"/Users/test/Desktop/Dev/github"
For detailed explanation on how things work, checkout the guide and docs for vue-loader.