vue-element-admin引入svg组件
此项目使用的是vue-element项目结构,当项目迁移的时候,注意以下几点配置svg组件。
1.webpack.base.conf.js配置
在mudule.rules中加入
{
test: /\.svg$/,
loader: 'svg-sprite-loader',
//使用这个loader需要下载此模块
include: [resolve('src/icons')],
options: {
symbolId: 'icon-[name]'
}
2.创建SvgIcon组件,src目录下的components
index.vue
<template>
<svg :class="svgClass" aria-hidden="true" v-if="login">