From 674d760029b451c0c6fc23a2aeac5c83992a0b27 Mon Sep 17 00:00:00 2001
From: kailong321200875 <321200875@qq.com>
Date: Tue, 27 Jun 2023 11:32:24 +0800
Subject: [PATCH] =?UTF-8?q?types:=20Form=E7=B1=BB=E5=9E=8B=E8=B0=83?=
=?UTF-8?q?=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ConfigGlobal/src/ConfigGlobal.vue | 4 +-
.../ConfigGlobal/src/types/index.ts | 4 +-
src/components/Form/src/Form.vue | 30 +++++++---
src/components/Form/src/types/index.ts | 57 ++++++++++++-------
.../SizeDropdown/src/SizeDropdown.vue | 5 +-
src/store/modules/app.ts | 12 ++--
src/views/Components/Form/UseFormDemo.vue | 4 +-
types/global.d.ts | 2 -
8 files changed, 72 insertions(+), 46 deletions(-)
diff --git a/src/components/ConfigGlobal/src/ConfigGlobal.vue b/src/components/ConfigGlobal/src/ConfigGlobal.vue
index 4594ebd..5bd90cf 100644
--- a/src/components/ConfigGlobal/src/ConfigGlobal.vue
+++ b/src/components/ConfigGlobal/src/ConfigGlobal.vue
@@ -1,7 +1,7 @@
diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts
index 8c66a49..fa22379 100644
--- a/src/store/modules/app.ts
+++ b/src/store/modules/app.ts
@@ -1,7 +1,7 @@
import { defineStore } from 'pinia'
import { store } from '../index'
import { setCssVar, humpToUnderline } from '@/utils'
-import { ElMessage } from 'element-plus'
+import { ElMessage, ComponentSize } from 'element-plus'
import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache()
@@ -26,8 +26,8 @@ interface AppState {
title: string
userInfo: string
isDark: boolean
- currentSize: ElementPlusSize
- sizeMap: ElementPlusSize[]
+ currentSize: ComponentSize
+ sizeMap: ComponentSize[]
mobile: boolean
footer: boolean
theme: ThemeTypes
@@ -156,10 +156,10 @@ export const useAppStore = defineStore('app', {
getIsDark(): boolean {
return this.isDark
},
- getCurrentSize(): ElementPlusSize {
+ getCurrentSize(): ComponentSize {
return this.currentSize
},
- getSizeMap(): ElementPlusSize[] {
+ getSizeMap(): ComponentSize[] {
return this.sizeMap
},
getMobile(): boolean {
@@ -245,7 +245,7 @@ export const useAppStore = defineStore('app', {
}
wsCache.set('isDark', this.isDark)
},
- setCurrentSize(currentSize: ElementPlusSize) {
+ setCurrentSize(currentSize: ComponentSize) {
this.currentSize = currentSize
wsCache.set('currentSize', this.currentSize)
},
diff --git a/src/views/Components/Form/UseFormDemo.vue b/src/views/Components/Form/UseFormDemo.vue
index 7e11c39..c32116f 100644
--- a/src/views/Components/Form/UseFormDemo.vue
+++ b/src/views/Components/Form/UseFormDemo.vue
@@ -4,7 +4,7 @@ import { ContentWrap } from '@/components/ContentWrap'
import { useI18n } from '@/hooks/web/useI18n'
import { useForm } from '@/hooks/web/useForm'
import { reactive, unref, ref } from 'vue'
-import { ElButton, ElInput, FormItemProp } from 'element-plus'
+import { ElButton, ElInput, FormItemProp, ComponentSize } from 'element-plus'
import { useValidator } from '@/hooks/web/useValidator'
import { getDictOneApi } from '@/api/common'
@@ -113,7 +113,7 @@ const changeLabelWidth = (width: number | string) => {
})
}
-const changeSize = (size: string) => {
+const changeSize = (size: ComponentSize) => {
setProps({
size
})
diff --git a/types/global.d.ts b/types/global.d.ts
index 31eddfa..fe4b285 100644
--- a/types/global.d.ts
+++ b/types/global.d.ts
@@ -17,8 +17,6 @@ declare global {
declare type TimeoutHandle = ReturnType
declare type IntervalHandle = ReturnType
- declare type ElementPlusSize = 'default' | 'small' | 'large'
-
declare type ElementPlusInfoType = 'success' | 'info' | 'warning' | 'danger'
declare type LayoutType = 'classic' | 'topLeft' | 'top' | 'cutMenu'