make-installer.ts 655 B

12345678910111213141516171819202122
  1. import { provideGlobalConfig } from '@element-plus/components/config-provider'
  2. import { INSTALLED_KEY } from '@element-plus/constants'
  3. import { version } from './version'
  4. import type { App, Plugin } from '@vue/runtime-core'
  5. import type { ConfigProviderContext } from '@element-plus/components/config-provider'
  6. export const makeInstaller = (components: Plugin[] = []) => {
  7. const install = (app: App, options?: ConfigProviderContext) => {
  8. if (app[INSTALLED_KEY]) return
  9. app[INSTALLED_KEY] = true
  10. components.forEach((c) => app.use(c))
  11. if (options) provideGlobalConfig(options, app, true)
  12. }
  13. return {
  14. version,
  15. install,
  16. }
  17. }