All Projects → cenkai88 → Vue Svg Icon

cenkai88 / Vue Svg Icon

Licence: other
a solution for multicolor svg icons in vue2.0 (vue2.0的可变彩色svg图标方案)

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vue Svg Icon

Linearicons
Linearicons is the highest quality set of line icons, matching with minimalist UI designs in iOS.
Stars: ✭ 64 (-88.43%)
Mutual labels:  svg, icon
Tabler Icons
A set of over 1400 free MIT-licensed high-quality SVG icons for you to use in your web projects.
Stars: ✭ 10,858 (+1863.47%)
Mutual labels:  svg, icon
Icotar
A free colorful icon avatar generator.
Stars: ✭ 94 (-83%)
Mutual labels:  svg, icon
Yii2 Widget Rating
A Yii2 widget for the simple yet powerful bootstrap-star-rating plugin with fractional rating support (sub repo split from yii2-widgets)
Stars: ✭ 47 (-91.5%)
Mutual labels:  svg, icon
Vue Awesome
Awesome SVG icon component for Vue.js, built-in with Font Awesome icons.
Stars: ✭ 2,302 (+316.27%)
Mutual labels:  svg, icon
React Icomoon
It allows you to simply view the icons in the selection.json file provided by Icomoon.
Stars: ✭ 48 (-91.32%)
Mutual labels:  svg, icon
Sb
SVG badges to display
Stars: ✭ 99 (-82.1%)
Mutual labels:  svg, icon
Icons
The premium icon font for @uiwjs Component Library. https://uiwjs.github.io/icons
Stars: ✭ 99 (-82.1%)
Mutual labels:  svg, icon
Svelte Awesome
Awesome SVG icon component for Svelte JS, built with Font Awesome icons. Based on Justineo/vue-awesome
Stars: ✭ 193 (-65.1%)
Mutual labels:  svg, icon
Akar Icons
A perfectly rounded icon library made for designers, developers, and pretty much everyone.
Stars: ✭ 184 (-66.73%)
Mutual labels:  svg, icon
Ruby Gem Downloads Badge
Clean and simple gem downloads count badge, courtesy of http://shields.io/. You can checkout the application directly at the following URL:
Stars: ✭ 29 (-94.76%)
Mutual labels:  svg, icon
Iconpark
🍎Transform an SVG icon into multiple themes, and generate React icons,Vue icons,svg icons
Stars: ✭ 4,924 (+790.42%)
Mutual labels:  svg, icon
Svgicon
SVG icon components and tool set
Stars: ✭ 817 (+47.74%)
Mutual labels:  svg, icon
Fontello Svg
Generate SVG icons from a Fontello icon set.
Stars: ✭ 59 (-89.33%)
Mutual labels:  svg, icon
Vue Octicon
Octicon component for Vue.js, using inline SVG.
Stars: ✭ 129 (-76.67%)
Mutual labels:  svg, icon
Remixicon
Open source neutral style icon system
Stars: ✭ 3,956 (+615.37%)
Mutual labels:  svg, icon
Pixo
Convert SVG icons into React components
Stars: ✭ 371 (-32.91%)
Mutual labels:  svg, icon
Elm Charts
Create SVG charts in Elm.
Stars: ✭ 482 (-12.84%)
Mutual labels:  svg
Vue Svg Loader
🔨 webpack loader that lets you use SVG files as Vue components
Stars: ✭ 514 (-7.05%)
Mutual labels:  svg
Github Corners
A fresher "Fork me on GitHub" callout.
Stars: ✭ 4,583 (+728.75%)
Mutual labels:  svg

vue-svg-icon

a solution for multicolor svg icons in vue2 轻量的Vue2多色动态svg图标方案 中文版说明

v1.2.9

demo: https://cenkai88.github.io/vue-svg-icon/demo/
features:

  • no need to inject SVG in main.js anymore
  • support path, circle, ellipse, rect, line, polyline, polygon tag of SVG
  • support grouped tags in SVG
  • real-time svg editing in illustrator or sketch
  • dynamically set the color of ONE PART of the svg through css 'color' property
  • an awesome SVG icon site iconfont

Usage

1. install

npm install vue-svg-icon --save-dev

2. put your svg into src/svg/

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

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

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

4. use the svg icon in your vue!

<icon name="chameleon" :scale="20"></icon>

Edit svg pictures in illustrator

  • Notice all the rect or line should be converted to path.(not anymore since v1.1.0)
  • When saving the SVG, please choose 'Save As' and set CSS Properties as 'Presentation Attributes' in advanced settings.
  • Pls set the color of the part that can be changed through css as #000000 in illustrator,if you want to use black in SVG but don't want it to be altered by css, pls set it as #000001
  • the color of stroke can be controlled through stroke property of icon if set as #000000 (since v1.1.0).
  • recommended size of SVG is 200*200

Trouble Shooting

  1. cannot find corresponding .svg file in vue-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". 
  1. cannot find the "svg" fold in src folder
This dependency was not found:
   
   * !xml-loader!../../src/svg in ./~/[email protected]/lib!./~/[email protected]/lib/selector.js?type=script&index=0!./~/[email protected]/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"

中文版本说明

示例: https://cenkai88.github.io/vue-svg-icon/demo/   特点:

  • 不再需要通过inject注册SVG
  • 支持SVG文件中path, circle, ellipse, rect, line, polyline, polygon 标签
  • 支持SVG文件中存在编组的标签
  • 可即时在illustrator中编辑svg图片
  • 可通过css的color属性动态地调整svg中某一部分的颜色

1. 安装

npm install vue-svg-icon --save-dev

2. 将svg图片放入src/svg/

这里安利一个svg图片库iconfont

  • src/svg路径暂时不可配置
  • src文件夹应和node_modules在同一个文件夹下

3. 在项目的main.js入口引入vue-svg-icon

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

4. 在网页中使用icon标签就可以啦!

<icon name="chameleon" scale="20"></icon>

在illustrator中编辑svg图片时

  • 注意illustrator中所有的矩形线段等等需转成复合路径再保存。(v1.1.0后不再需要)
  • 第一次编辑完保存时,请选择"另存为",在"高级选项"中将"css属性"设置成演示文稿属性
  • 需要通过css动态设置颜色等部分请将填充色设为纯黑(#000000),如果想设置黑色但不受SVG的color影响请将填充色设为(#000001)
  • 描边的颜色同样可在illustrator或sketch中设为纯黑(#000000),然后通过icon的CSS中stroke属性来动态控制 (自v1.1.0起)。
  • 推荐SVG尺寸为200*200

For detailed explanation on how things work, checkout the guide and docs for vue-loader.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].