fix(form): form validate error

This commit is contained in:
vben
2020-12-28 22:04:05 +08:00
parent 08df198710
commit a305e59124
20 changed files with 82 additions and 36 deletions

View File

@@ -1,4 +1,5 @@
export const timestamp = () => +Date.now();
import { unref } from 'vue';
import { isObject } from '/@/utils/is';
export const clamp = (n: number, min: number, max: number) => Math.min(max, Math.max(min, n));
export const noop = () => {};
@@ -76,3 +77,14 @@ export function openWindow(
window.open(url, target, feature.join(','));
}
// dynamic use hook props
export function getDynamicProps<T, U>(props: T): Partial<U> {
const ret: Recordable = {};
Object.keys(props).map((key) => {
ret[key] = unref((props as Recordable)[key]);
});
return ret as Partial<U>;
}