fix: 类型报错

This commit is contained in:
菲鸽 2024-03-27 17:41:15 +08:00
parent 8de552d83a
commit 245d74b9eb
3 changed files with 13 additions and 5 deletions

View File

@ -1,6 +1,5 @@
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { ref } from 'vue' import { ref } from 'vue'
import { IUserInfo } from '../typings'
const initState = { nickname: '', avatar: '' } const initState = { nickname: '', avatar: '' }

15
src/typings.d.ts vendored
View File

@ -1,13 +1,22 @@
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
// 全局要用的类型放到这里 // 全局要用的类型放到这里
export type IResData<T> = { type IResData<T> = {
code: number code: number
msg: string msg: string
result: T result: T
} }
export type IUserInfo = { // uni.uploadFile文件上传参数
type IUniUploadFileOptions = {
file?: File
files?: UniApp.UploadFileOptionFiles[]
filePath?: string
name?: string
formData?: any
}
type IUserInfo = {
nickname?: string nickname?: string
avatar?: string avatar?: string
/** 微信的 openid非微信没有这个字段 */ /** 微信的 openid非微信没有这个字段 */
@ -15,7 +24,7 @@ export type IUserInfo = {
token?: string token?: string
} }
export enum TestEnum { enum TestEnum {
A = 'a', A = 'a',
B = 'b', B = 'b',
} }

View File

@ -1,5 +1,5 @@
import pagesJson from '@/pages.json'
import { translate as t } from '@/locale/index' import { translate as t } from '@/locale/index'
import pagesJson from '@/pages.json'
console.log(pagesJson) console.log(pagesJson)