You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
488 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import Vue from 'vue'
import SvgIcon from '@/components/SvgIcon'// svg组件
// 全局注册
Vue.component('svg-icon', SvgIcon)
// 要引入svg下面所有的svg文件 在该文件icons目录下新建一个js文件index.js 写如下代码:
const req = require.context('./svg', false, /\.svg$/) // require.context函数遍历svg文件夹的所有文件一次性导入到index.js中
const requireAll = requireContext => requireContext.keys().map(requireContext)
requireAll(req)