20 lines
429 B
TypeScript
20 lines
429 B
TypeScript
import type { App, Component } from 'vue'
|
|
|
|
// 当组件很多的时候,可以使用
|
|
import { SvgIcon } from '@/components/StaticExtend/SvgIcon'
|
|
|
|
// 这个地方将合并到对象中
|
|
const Components: {
|
|
[propName: string]: Component
|
|
} = { SvgIcon }
|
|
|
|
// 批量注册全局组件
|
|
export default {
|
|
install: (app: App) => {
|
|
Object.keys(Components).forEach((key) => {
|
|
app.component(key, Components[key])
|
|
})
|
|
},
|
|
}
|
|
|