mand-mobile/components/icon
Shawn Xu c0b1895cb0 extract iconfont font-family into variables (#369)
* fix(icon): extract font-family into variables

* build: update stylus variables regex
2019-03-21 23:58:49 +08:00
..
demo feat(icon): add woff 2019-01-04 14:45:29 +08:00
test test: update snapshots 2019-01-29 11:34:25 +08:00
README.en-US.md doc(icon): update readme 2019-03-21 23:07:22 +08:00
README.md doc(icon): fix icon usage 2019-02-14 14:42:54 +08:00
default-svg-list.js feat(svg): update svg source files 2019-01-04 11:56:41 +08:00
iconfont.ttf fix(icon): update icon font 2018-12-03 19:07:37 +08:00
iconfont.woff feat(icon): add woff 2019-01-04 14:45:29 +08:00
index.vue extract iconfont font-family into variables (#369) 2019-03-21 23:58:49 +08:00
load-spirte.js test: add ignore comments & optimize judgment 2019-01-18 17:46:58 +08:00
selection.json fix(icon): update icon font 2018-12-03 19:07:37 +08:00

README.en-US.md

title preview
Icon https://didi.github.io/mand-mobile/examples/#/icon

IconFont、SVG Icons

Import

import { Icon } from 'mand-mobile'

Vue.component(Icon.name, Icon)

Code Examples

API

Icon Props

Props Description Type Default Note
name icon name String - -
size icon size String md xs, sm, md, lg
color icon color String currentColor this color value is set as the value of fill on the svg icon
svg use svg icon Boolean false refer to #Appendix

Appendix

As for custom svg icons, you need to use svg-sprite-loader, svg file name is the icon name.

  1. Install Dependencies
npm install svg-sprite-loader --save-dev
  1. Webpack Configuration
const path = require('path')

module.exports = {
  module: {
    loaders: [
      {
        test: /\.svg$/i,
        loader: 'svg-sprite-loader',
        include: [
          // All svg icons in a path are handled by svg-sprite-loader plugin
          path.resolve(__dirname, 'src/my-project-svg-folder')
        ],
      }
    ]
  }
}
  1. Import Icons
<template>
  <div>
    <md-icon name="hello" svg></md-icon>
    <md-icon name="world" svg></md-icon>
  </div>
</template>

<script>
import 'src/my-project-svg-folder/hello.svg'
import 'src/my-project-svg-folder/world.svg'
import { Icon } from 'mand-mobile'

export default {
  name: 'icon-demo',
  components: {
    [Icon.name]: Icon
  }
}
</script>