perf: 同步完整版代码
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable */
|
||||
const toString = Object.prototype.toString;
|
||||
|
||||
export function is(val: unknown, type: string) {
|
||||
@@ -94,9 +93,26 @@ export const isServer = typeof window === "undefined";
|
||||
|
||||
export const isClient = !isServer;
|
||||
|
||||
export function isUrl<T>(path: T): boolean {
|
||||
/** url链接正则 */
|
||||
export function isUrl<T>(value: T): boolean {
|
||||
const reg =
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
/(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
|
||||
// @ts-expect-error
|
||||
return reg.test(path);
|
||||
return reg.test(value);
|
||||
}
|
||||
|
||||
/** 手机号码正则 */
|
||||
export function isPhone<T>(value: T): boolean {
|
||||
const reg =
|
||||
/^[1](([3][0-9])|([4][0,1,4-9])|([5][0-3,5-9])|([6][2,5,6,7])|([7][0-8])|([8][0-9])|([9][0-3,5-9]))[0-9]{8}$/;
|
||||
// @ts-expect-error
|
||||
return reg.test(value);
|
||||
}
|
||||
|
||||
/** 邮箱正则 */
|
||||
export function isEmail<T>(value: T): boolean {
|
||||
const reg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
|
||||
// @ts-expect-error
|
||||
return reg.test(value);
|
||||
}
|
||||
|
4
src/utils/useComponent.ts
Normal file
4
src/utils/useComponent.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { h, resolveComponent } from "vue";
|
||||
|
||||
export const dynamicComponent = (component: string) =>
|
||||
h(resolveComponent(component));
|
Reference in New Issue
Block a user