如何引入Icon-font到Antdocs主题中
局部引入
- 直接在
md
文件上加入script
style
里面的内容,通过<icon-font type="">
形式调用 - 新建组件,将组件做好以后直接调用组件
- 由于随着
icon-font
项目每次变更都要变更scripturl
的链接,局部使用会造成后续很麻烦
局部效果
组件代码如下:
<template>
<div class="icons-list">
<icon-font type="icon-xinbaniconshangchuan-" />
<icon-font type="icon-pengyouquan" />
<icon-font type="icon-weixin" />
<icon-font type="icon-shezhi" />
</div>
</template>
<script>
import { Icon } from 'ant-design-vue';
const IconFont = Icon.createFromIconfontCN({
scriptUrl: '//at.alicdn.com/t/font_2187595_8kqrctnmyku.js',
});
export default {
components: {
IconFont,
},
};
</script>
<style scoped>
.icons-list >>> .anticon {
margin-right: 6px;
font-size: 24px;
}
</style>
全局引入
暂时还不会…
后续等更新…