feat: Merge default items when saving rule

This commit is contained in:
Gabe
2025-09-26 12:40:19 +08:00
parent 14f74b76bb
commit 4935abcf33
4 changed files with 57 additions and 15 deletions

View File

@@ -317,3 +317,19 @@ export const scheduleIdle = (cb, timeout = 200) => {
}
return setTimeout(cb, timeout);
};
/**
* 截取url部分
* @param {*} href
* @returns
*/
export const parseUrlPattern = (href) => {
if (href.startsWith("file")) {
const filename = href.substring(href.lastIndexOf("/") + 1);
return filename;
} else if (href.startsWith("http")) {
const url = new URL(href);
return url.host;
}
return href;
};