1.首先需要www.iconfont.cn/ 这里面有个账户
2.然后建立一个项目,添加需要使用到的iconfont图标
3.然后建立一个 src/static/iconfont/ison.js,这个ji文件就是下载下来的里面的js
4.然后写一个组件,全局注册 VIcon 这个组件
<template>
<svg class="symbol-icon" aria-hidden="true" v-bind="$attrs">
<use :xlink:href="'#' + prefix + id" />
</svg>
</template>
<script>
export default {
name: 'VIcon',
props: {
id: {
type: String,
default: ''
},
size: {
type: String,
default: ''
},
prefix: {
type: String,
default: ''
}
}
}
</script>
<style lang="scss" scoped>
.symbol-icon {
overflow: hidden;
width: 1em;
height: 1em;
fill: currentColor;
vertical-align: -0.15em;
}
</style>
5.使用,id名字就取阿里巴巴矢量库里面的复制出来的名字