vue2-svg-icon

A solution for svg icon in vue2.0
3,471
Install
npm install vue2-svg-icon
Latest Version:1.3.2
Vue:2
License:ISC
Last Updated:Mar 30, 2017
Links: npm
Maintainer: headless-igg

vue2-svg-icon

本项目是在cenkai88的vue-svg-icon项目上修改的,移除了一些我不需要的功能,props也做了一些修改。请移步vue-svg-icon

v1.3.2

Usage

1. install

npm install vue2-svg-icon --save-dev

2. put your svg into src/assets/svg/

  • this dir are not supported to be configured now
  • src folder should be in the same folder with node_modules

3. import vue2-svg-icon in your main.js

import Icon from 'vue2-svg-icon/Icon.vue';
Vue.component('icon', Icon);  

4. use the svg icon in your vue!

  • name: svg file name
  • w: width (accept String or Number)
  • h: height (accept String or Nnmber)
<icon name="chameleon" :w="24" :h="24"></icon>

Trouble Shooting

  1. 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.

  1. 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
  1. 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.

Related Packages

@jt-icons/icon-vue-components

Vue components of JT Icons collection.

2,961 1
vicons

SVG Vue components integrated from `fluentui-system-icons` and `ionicons`.

53,979
vue-svg-icon

a simple solution for multicolor svg icon in vue

13,095
@starzkg/vuepress-social-icons

Icon library for Vuepress

7,676 1

Version History

Version Released Vue License
1.3.2 ^2.0.1 ISC
1.3.1 ^2.0.1 ISC
1.3.0 ^2.0.1 ISC
1.2.8 ^2.0.1 ISC
1.2.7 ^2.0.1 ISC