element-plus/packages/utils/with-install.ts
jeremywu c8d65bf43d
feat(locale): locale-provider (#2662)
- Add a component for providing configs
- Add `use-locale` hooks into hooks for composable usage
- Add `use-locale` for `config-provider` to allow user to provide locale config via `react-like` API
- Add test cases against these new features
2021-07-25 15:26:00 +08:00

14 lines
351 B
TypeScript

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>
}