You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
359 B
JavaScript

function getFileUrl(url){
// 如果是空的直接返回
if (!url) {
return url
}
// 如果是http开头的直接返回
if (/^http/.test(url)) {
return url
}
// 如果没有以/开头的加上/
if (!/^\//.test(url)) {
url = `/${url}`
}
return `${window.BS_CONFIG?.httpConfigs?.fileUrlPrefix}${url}`
}
export {
getFileUrl
}