element-plus/packages/utils/with-install.ts

14 lines
351 B
TypeScript
Raw Normal View History

import type { App, DefineComponent } from 'vue'
import type { SFCWithInstall } from './types'
/* istanbul ignore next */
export default <T>(component: T) => {
(component as any).install = (app: App) => {
app.component(
((component as unknown) as DefineComponent).name,
component,
)
}
return component as SFCWithInstall<T>
}