From f2ae977e9a52a573176ec4490621cdf75877ecd5 Mon Sep 17 00:00:00 2001
From: Rem <1941398048@qq.com>
Date: Tue, 31 Dec 2024 14:29:06 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9E=9A=E4=B8=BE=E5=A4=B1=E6=95=88?=
=?UTF-8?q?=E9=97=AE=E9=A2=98=20&=20=E5=88=86=E7=A6=BB=E5=85=A8=E5=B1=80?=
=?UTF-8?q?=E5=A3=B0=E6=98=8E=E5=92=8C=E6=A8=A1=E5=9D=97=E5=8C=96=E5=86=85?=
=?UTF-8?q?=E5=AE=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/pages/index/index.vue | 2 ++
src/typings.d.ts | 28 ++++++++++++++++++++++++++++
src/typings.ts | 31 ++++---------------------------
tsconfig.json | 3 ++-
4 files changed, 36 insertions(+), 28 deletions(-)
create mode 100644 src/typings.d.ts
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index 84d3606..59da0ab 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -31,6 +31,7 @@
diff --git a/src/typings.d.ts b/src/typings.d.ts
new file mode 100644
index 0000000..0ab0858
--- /dev/null
+++ b/src/typings.d.ts
@@ -0,0 +1,28 @@
+// 全局要用的类型放到这里
+
+declare global {
+ type IResData = {
+ code: number
+ msg: string
+ data: T
+ }
+
+ // uni.uploadFile文件上传参数
+ type IUniUploadFileOptions = {
+ file?: File
+ files?: UniApp.UploadFileOptionFiles[]
+ filePath?: string
+ name?: string
+ formData?: any
+ }
+
+ type IUserInfo = {
+ nickname?: string
+ avatar?: string
+ /** 微信的 openid,非微信没有这个字段 */
+ openid?: string
+ token?: string
+ }
+}
+
+export {} // 防止模块污染
diff --git a/src/typings.ts b/src/typings.ts
index 06354be..016e462 100644
--- a/src/typings.ts
+++ b/src/typings.ts
@@ -1,29 +1,6 @@
-// 全局要用的类型放到这里
+// 枚举定义
-type IResData = {
- code: number
- msg: string
- data: T
-}
-
-// uni.uploadFile文件上传参数
-type IUniUploadFileOptions = {
- file?: File
- files?: UniApp.UploadFileOptionFiles[]
- filePath?: string
- name?: string
- formData?: any
-}
-
-type IUserInfo = {
- nickname?: string
- avatar?: string
- /** 微信的 openid,非微信没有这个字段 */
- openid?: string
- token?: string
-}
-
-enum TestEnum {
- A = 'a',
- B = 'b',
+export enum TestEnum {
+ A = '1',
+ B = '2',
}
diff --git a/tsconfig.json b/tsconfig.json
index 8390fbe..495932e 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -20,7 +20,8 @@
"@uni-helper/uni-types",
"@types/wechat-miniprogram",
"wot-design-uni/global.d.ts",
- "z-paging/types"
+ "z-paging/types",
+ "./src/typings.d.ts"
]
},
"vueCompilerOptions": {