commit
424fd937d9
@ -31,6 +31,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { TestEnum } from '@/typings'
|
||||||
import PLATFORM from '@/utils/platform'
|
import PLATFORM from '@/utils/platform'
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
@ -46,6 +47,7 @@ const description = ref(
|
|||||||
// 测试 uni API 自动引入
|
// 测试 uni API 自动引入
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
console.log(author)
|
console.log(author)
|
||||||
|
console.log(TestEnum.A)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
28
src/typings.d.ts
vendored
Normal file
28
src/typings.d.ts
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// 全局要用的类型放到这里
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
type IResData<T> = {
|
||||||
|
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 {} // 防止模块污染
|
@ -1,29 +1,6 @@
|
|||||||
// 全局要用的类型放到这里
|
// 枚举定义
|
||||||
|
|
||||||
type IResData<T> = {
|
export enum TestEnum {
|
||||||
code: number
|
A = '1',
|
||||||
msg: string
|
B = '2',
|
||||||
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',
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,8 @@
|
|||||||
"@uni-helper/uni-types",
|
"@uni-helper/uni-types",
|
||||||
"@types/wechat-miniprogram",
|
"@types/wechat-miniprogram",
|
||||||
"wot-design-uni/global.d.ts",
|
"wot-design-uni/global.d.ts",
|
||||||
"z-paging/types"
|
"z-paging/types",
|
||||||
|
"./src/typings.d.ts"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"vueCompilerOptions": {
|
"vueCompilerOptions": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user