{配置兼容性}

This commit is contained in:
tangly1024
2024-06-15 10:34:55 +08:00
parent 2e983e4876
commit 19d9d896c4
5 changed files with 69 additions and 40 deletions

View File

@@ -81,8 +81,21 @@ export function convertUrlStartWithOneSlash(str) {
return str
}
/**
* 是否是一个相对或绝对路径的ur类
* @param {*} str
* @returns
*/
export function isUrl(str) {
if (!str) {
return false
}
return str?.indexOf('/') === 0 || checkStartWithHttp(str)
}
// 检查是否外链
export function checkContainHttp(str) {
export function checkStartWithHttp(str) {
// 检查字符串是否包含http
if (str?.includes('http:') || str?.includes('https:')) {
// 如果包含找到http的位置