refactor: ♻️ 重构API为静态方法实现模块化管理,并将types.ts重命名为model.ts用于存放接口模型定义
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { UploadRawFile, UploadRequestOptions } from "element-plus";
|
||||
import { uploadFileApi } from "@/api/file";
|
||||
import FileAPI from "@/api/file";
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
@@ -33,7 +33,7 @@ const imgUrl = useVModel(props, "modelValue", emit);
|
||||
* @param options
|
||||
*/
|
||||
async function uploadFile(options: UploadRequestOptions): Promise<any> {
|
||||
const { data: fileInfo } = await uploadFileApi(options.file);
|
||||
const { data: fileInfo } = await FileAPI.update(options.file);
|
||||
imgUrl.value = fileInfo.url;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user