mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-14 09:20:51 +08:00
3d77bcd29b
closes #6760
23 lines
590 B
TypeScript
23 lines
590 B
TypeScript
import { provideGlobalConfig } from '@element-plus/hooks'
|
|
import { version } from './version'
|
|
import type { App, Plugin } from 'vue'
|
|
import type { ConfigProviderContext } from '@element-plus/tokens'
|
|
|
|
const INSTALLED_KEY = Symbol('INSTALLED_KEY')
|
|
|
|
export const makeInstaller = (components: Plugin[] = []) => {
|
|
const install = (app: App, options?: ConfigProviderContext) => {
|
|
if (app[INSTALLED_KEY]) return
|
|
|
|
app[INSTALLED_KEY] = true
|
|
components.forEach((c) => app.use(c))
|
|
|
|
if (options) provideGlobalConfig(options, app, true)
|
|
}
|
|
|
|
return {
|
|
version,
|
|
install,
|
|
}
|
|
}
|