From 1728006c7507dc973e684e0b03040304fa05e08a Mon Sep 17 00:00:00 2001
From: GuLiMmo <2820890765@qq.com>
Date: Tue, 27 Aug 2024 17:03:32 +0800
Subject: [PATCH] chore:接入新框架api
---
src/utils/common.ts | 27 ++++++++++++++++++++++++---
1 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/src/utils/common.ts b/src/utils/common.ts
index 891e618..c0e1549 100644
--- a/src/utils/common.ts
+++ b/src/utils/common.ts
@@ -1,9 +1,21 @@
+/*
+ * @Author: GuLiMmo 2820890765@qq.com
+ * @Date: 2024-03-12 17:59:03
+ * @LastEditors: GuLiMmo 2820890765@qq.com
+ * @LastEditTime: 2024-08-27 16:52:42
+ * @FilePath: /drone-web/src/utils/common.ts
+ * @Description:
+ * Copyright (c) 2024 by GuLiMmo, All Rights Reserved.
+ */
+
+import { validatenull } from './validate'
+
/**
* 下载文件
* @param data
* @param fileName
*/
-export function downloadFile (data: Blob, fileName: string) {
+export const downloadFile = (data: Blob, fileName: string) => {
const lable = document.createElement('a')
lable.href = window.URL.createObjectURL(data)
lable.download = fileName
@@ -11,6 +23,15 @@
URL.revokeObjectURL(lable.href)
}
-export const requireImg = (imgPath: string) => {
- return new URL(`../assets/${imgPath}`, import.meta.url).href
+// 表单序列化
+export const serialize = (data: { [x: string]: any }) => {
+ const list: string[] = []
+ Object.keys(data).forEach((ele) => {
+ list.push(`${ele}=${data[ele]}`)
+ })
+ return list.join('&')
+}
+
+export const requireImg = (path: string) => {
+ return new URL(`/src/assets/${path}`, import.meta.url).href
}
--
Gitblit v1.9.3