fix(type): 修复Axios请求类型声明

This commit is contained in:
PKC278
2025-12-30 03:43:20 +08:00
parent daa8f857f8
commit 2e3314e6c3
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -196,7 +196,7 @@ async function list_files() {
} }
// 加载数据 // 加载数据
const data = ((await inProps.axios.request(config)) as any) ?? [] const data = ((await inProps.axios.request<FileItem[], FileItem[]>(config))) ?? []
// 如果当前路径已经变化,则放弃此次加载结果 // 如果当前路径已经变化,则放弃此次加载结果
if (prevURI !== takeURISnapshot()) { if (prevURI !== takeURISnapshot()) {
return; return;
@@ -300,7 +300,7 @@ async function download(item: FileItem) {
responseType: 'blob', responseType: 'blob',
} }
// 加载数据 // 加载数据
const result: Blob = (await inProps.axios.request(config)) as any const result: Blob = (await inProps.axios.request<Blob, Blob>(config))
if (result) { if (result) {
const downloadUrl = URL.createObjectURL(result) const downloadUrl = URL.createObjectURL(result)
window.open(downloadUrl, '_blank') window.open(downloadUrl, '_blank')
@@ -318,7 +318,7 @@ async function getImgLink(item: FileItem) {
responseType: 'blob', responseType: 'blob',
} }
// 加载二进制数据 // 加载二进制数据
const result: Blob = (await inProps.axios.request(config)) as any const result: Blob = (await inProps.axios.request<Blob, Blob>(config))
if (result) { if (result) {
// 创建图片地址 // 创建图片地址
currentImgLink.value = URL.createObjectURL(result) currentImgLink.value = URL.createObjectURL(result)
@@ -395,7 +395,7 @@ async function rename() {
method: inProps.endpoints?.rename.method || 'post', method: inProps.endpoints?.rename.method || 'post',
data: currentItem.value, data: currentItem.value,
} }
const result: { [key: string]: any } = (await inProps.axios?.request(config)) as any const result: { [key: string]: any } = (await inProps.axios?.request<any, { [key: string]: any }>(config))
if (!result.success) { if (!result.success) {
$toast.error(result.message) $toast.error(result.message)
} }
+1 -1
View File
@@ -131,7 +131,7 @@ async function loadSubdirectories(path: string) {
data: fakeItem, data: fakeItem,
} }
const result = (await props.axios?.request(config)) as any const result = (await props.axios?.request(config))
if (result && Array.isArray(result)) { if (result && Array.isArray(result)) {
// 过滤出目录项 // 过滤出目录项
const dirs = result.filter(item => item.type === 'dir') const dirs = result.filter(item => item.type === 'dir')