feat: 工具函数
This commit is contained in:
@@ -672,6 +672,17 @@ function sketchToMask(sketchImage) {
|
||||
img.src = sketchImage;
|
||||
});
|
||||
}
|
||||
|
||||
function isValidUrl(string) {
|
||||
try {
|
||||
const url = new URL(string)
|
||||
// 通常我们只需要 http 或 https 协议
|
||||
return url.protocol === "http:" || url.protocol === "https:"
|
||||
} catch (err) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
isEmail,
|
||||
getUploadUrl,
|
||||
|
||||
Reference in New Issue
Block a user