mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-21 01:02:59 +08:00
refactor: improve types (#4746)
This commit is contained in:
parent
db1d9401fe
commit
b6c077e2c1
@ -95,6 +95,7 @@ import { ElTransfer } from '@element-plus/components/transfer'
|
||||
import { ElTree } from '@element-plus/components/tree'
|
||||
import { ElTreeV2 } from '@element-plus/components/tree-v2'
|
||||
import { ElUpload } from '@element-plus/components/upload'
|
||||
import type { Plugin } from 'vue'
|
||||
|
||||
export default [
|
||||
ElAffix,
|
||||
@ -187,4 +188,4 @@ export default [
|
||||
ElTree,
|
||||
ElTreeV2,
|
||||
ElUpload,
|
||||
]
|
||||
] as Plugin[]
|
||||
|
@ -1,4 +1,4 @@
|
||||
import makeInstaller from './make-installer'
|
||||
import { makeInstaller } from './make-installer'
|
||||
import Components from './component'
|
||||
import Plugins from './plugin'
|
||||
|
||||
|
@ -4,7 +4,7 @@ export * from '@element-plus/directives'
|
||||
export * from '@element-plus/hooks'
|
||||
export * from '@element-plus/tokens'
|
||||
|
||||
export { default as makeInstaller } from './make-installer'
|
||||
export { makeInstaller } from './make-installer'
|
||||
export { default } from './defaults'
|
||||
|
||||
export const install = installer.install
|
||||
|
@ -3,15 +3,14 @@ import { localeContextKey, localeProviderMaker } from '@element-plus/hooks'
|
||||
import { version } from './version'
|
||||
|
||||
import type { App, Plugin } from 'vue'
|
||||
import type { ComponentSize } from '@element-plus/utils/types'
|
||||
import type { InstallOptions } from '@element-plus/utils/config'
|
||||
|
||||
const makeInstaller = (components: Plugin[] = []) => {
|
||||
export const makeInstaller = (components: Plugin[] = []) => {
|
||||
const apps: App[] = []
|
||||
|
||||
const install = (app: App, opts: InstallOptions) => {
|
||||
const defaultInstallOpt: InstallOptions = {
|
||||
size: '' as ComponentSize,
|
||||
size: '',
|
||||
zIndex: 2000,
|
||||
}
|
||||
|
||||
@ -19,9 +18,7 @@ const makeInstaller = (components: Plugin[] = []) => {
|
||||
if (apps.includes(app)) return
|
||||
apps.push(app)
|
||||
|
||||
components.forEach((c) => {
|
||||
app.use(c)
|
||||
})
|
||||
components.forEach((c) => app.use(c))
|
||||
|
||||
if (option.locale) {
|
||||
const localeProvides = localeProviderMaker(opts.locale)
|
||||
@ -38,5 +35,3 @@ const makeInstaller = (components: Plugin[] = []) => {
|
||||
install,
|
||||
}
|
||||
}
|
||||
|
||||
export default makeInstaller
|
||||
|
@ -5,6 +5,8 @@ import { ElMessageBox } from '@element-plus/components/message-box'
|
||||
import { ElNotification } from '@element-plus/components/notification'
|
||||
import { ElPopoverDirective } from '@element-plus/components/popover'
|
||||
|
||||
import type { Plugin } from 'vue'
|
||||
|
||||
export default [
|
||||
ElInfiniteScroll,
|
||||
ElLoading,
|
||||
@ -12,4 +14,4 @@ export default [
|
||||
ElMessageBox,
|
||||
ElNotification,
|
||||
ElPopoverDirective,
|
||||
]
|
||||
] as Plugin[]
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { ComponentSize } from './types'
|
||||
|
||||
export interface InstallOptions {
|
||||
size: ComponentSize
|
||||
size: ComponentSize | ''
|
||||
zIndex: number
|
||||
locale?: any
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user