vue3 ts 使用 Ant Design Vue 全局引入 icons

import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Antd from 'ant-design-vue'
//导入所有图标库
import * as Icons from "@ant-design/icons-vue";
import type { Component } from 'vue'

import 'ant-design-vue/dist/antd.css';


const app = createApp(App)

app.use(store).use(router).use(Antd)

const IconData: Record = Icons
console.log('IconData', IconData)
Object.keys(IconData).forEach((key: string) => {
    app.component(key, IconData[key]);
})
app.mount('#app')

重点是使用 Record

你可能感兴趣的:(ts,vue,vue.js,typescript)