mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-27 14:31:41 +08:00
wip(form): perf form
This commit is contained in:
@@ -7,8 +7,8 @@ const ls = createStorage(localStorage);
|
||||
const ss = createStorage();
|
||||
|
||||
interface CacheStore {
|
||||
local: Record<string, any>;
|
||||
session: Record<string, any>;
|
||||
local: Recordable;
|
||||
session: Recordable;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -35,7 +35,7 @@ export function extendSlots(slots: Slots, excludeKeys: string[] = []) {
|
||||
}
|
||||
|
||||
// Get events on attrs
|
||||
export function getListeners(attrs: Record<string, unknown>) {
|
||||
export function getListeners(attrs: Recordable<unknown>) {
|
||||
const listeners: any = {};
|
||||
Object.keys(attrs).forEach((key) => {
|
||||
if (/^on/.test(key)) {
|
||||
|
@@ -9,6 +9,7 @@ import {
|
||||
reactive,
|
||||
ComponentInternalInstance,
|
||||
} from 'vue';
|
||||
import { error } from '../log';
|
||||
|
||||
export function explicitComputed<T, S>(source: WatchSource<S>, fn: () => T) {
|
||||
const v = reactive<any>({ value: fn() });
|
||||
@@ -39,6 +40,6 @@ export function tryTsxEmit<T extends any = ComponentInternalInstance>(
|
||||
|
||||
export function isInSetup() {
|
||||
if (!getCurrentInstance()) {
|
||||
throw new Error('Please put useForm function in the setup function!');
|
||||
error('Please put useForm function in the setup function!');
|
||||
}
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ export interface Result<T = any> {
|
||||
// multipart/form-data:上传文件
|
||||
export interface UploadFileParams {
|
||||
// 其他参数
|
||||
data?: { [key: string]: any };
|
||||
data?: Indexable;
|
||||
// 文件参数的接口字段名
|
||||
name?: string;
|
||||
// 文件
|
||||
|
@@ -38,7 +38,7 @@ export function setObjToUrlParams(baseUrl: string, obj: any): string {
|
||||
return url;
|
||||
}
|
||||
|
||||
export function deepMerge<T = any>(src: any, target: any): T {
|
||||
export function deepMerge<T = any>(src: any = {}, target: any = {}): T {
|
||||
let key: string;
|
||||
for (key in target) {
|
||||
src[key] = isObject(src[key]) ? deepMerge(src[key], target[key]) : (src[key] = target[key]);
|
||||
|
@@ -3,3 +3,7 @@ const projectName = import.meta.env.VITE_GLOB_APP_TITLE;
|
||||
export function warn(message: string) {
|
||||
console.warn(`[${projectName} warn]:${message}`);
|
||||
}
|
||||
|
||||
export function error(message: string) {
|
||||
throw new Error(`[${projectName} error]:${message}`);
|
||||
}
|
||||
|
Reference in New Issue
Block a user