n_configure

1.0.1 • Public • Published
svg 图标自定义配置
  • svg 图标根据项目自定义本地配置,需要在本地建 svg 图片库,下面使用说明中svg路径为本地 svg 图片库路径
下载
 npm install n_configure -S
页面使用
import configure, { getSvgList } from 'n_configure'
import 'n_configure/index.css'
getSvgList(require.context('svg路径', true, /\.svg$/))   //svg路径必写

components: { configure }   //注册组件

因用到了 svg,故需要配置 svg loader

下载
 npm install svg-sprite-loader —D
vue.config.js 中配置
 chainWebpack(config) {
  config.module.rule('svg').exclude.add(resolve('svg路径'))
    config.module
      .rule('icons')
      .test(/\.svg$/)
      .include.add(resolve('svg路径'))
      .end()
      .use('svg-sprite-loader')
      .loader('svg-sprite-loader')
      .options({ symbolId: 'icon-[name]' })
 }

Readme

Keywords

none

Package Sidebar

Install

npm i n_configure

Weekly Downloads

1

Version

1.0.1

License

none

Unpacked Size

4.3 MB

Total Files

14

Last publish

Collaborators

  • web_niu