注册组件的使用

注册组件的使用

ant-design element-plus中icon的使用

起因是因为我要在组件里面使用icon,奈何用的是vue3.0,

导致ant-design和element-plus的icon必须要注册了才能使用,

然鹅作为一个速成vuer,我不会注册一个组件,好在折腾了许久,在csdn上找了答案。

Vue3+TS+AntDV2.x使用icon/解决打包部署线上图标不生效问题

虽然是icon的注册与使用,但是对组件的注册、使用也有启发意义。

局部引用分为两步,一是import,二是添加到export中。

e.g.

import {LikeOutlined, EyeOutlined, CommentOutlined} from '@ant-design/icons-vue'
export default {
  name: "ArticleCard",
  components: {
    LikeOutlined,
    EyeOutlined,
    CommentOutlined
  }
}

全局引用,需要修个main.ts,注意是typescipt。

posted @ 2021-10-31 22:42  ticlab  阅读(101)  评论(0编辑  收藏  举报