Files
dcalc/frontend-ui/src/utils/images.ts
T
2026-08-04 17:57:01 +08:00

20 lines
497 B
TypeScript

let baseURL = 'https://image.dnftools.com'
// 避免远程开发的时候冲突
if (process.env.NODE_ENV == 'development') {
baseURL = '/image'
}
if (import.meta.env.MODE == 'web' || import.meta.env.MODE == 'show') {
baseURL = 'https://image.dnftools.com'
}
export const getImageURL = (image: string) => {
image = image.startsWith('/') ? image : `/${image}`
return `${baseURL}${image}`
}
export const getLocalImageURL = (url: string) => {
return new URL(url, import.meta.url).href
}