feat: 部分组件重构完成

This commit is contained in:
kailong321200875
2021-10-17 17:01:42 +08:00
parent 0f5c55c36d
commit 3d9622978d
27 changed files with 1790 additions and 78 deletions

View File

@@ -0,0 +1,18 @@
/**
* 为了保持多页element组件的样式统一提供全局配置的方法。
*/
import { ConfigElement } from './types'
const elementConfig: ConfigElement = {
/**
* 尺寸
*/
size: 'medium',
/**
* 层级
*/
zIndex: 2000
}
export default elementConfig

View File

@@ -0,0 +1,23 @@
// 按需加载element
// 目前需要手动引入loading等插件无法自动导入
// size和zIndex也需要这样设置暂时还无法在全局配置组件中去设置
// 需要看看后面官方是不是能优化这点
import type { App } from 'vue'
import ElementConfig from './element.config'
// element全局配置项
const { size, zIndex } = ElementConfig
import { ElLoading } from 'element-plus'
const plugins = [ElLoading]
export function setupElement(app: App<Element>): void {
plugins.forEach((plugin: any) => {
app.use(plugin)
})
// 全局配置
app.config.globalProperties.$ELEMENT = { size: size, zIndex: zIndex }
}

View File

@@ -0,0 +1,7 @@
/**
* element配置
*/
export interface ConfigElement {
zIndex: number
size: 'medium' | 'small' | 'mini'
}