imageUrl.js
389 Bytes
/**
* @file 次新车转化分包图片 URL 处理(不调 setData、不请求接口)。
*/
/**
* 将 http 资源链接转为 https,避免小程序 image 组件协议告警。
* @param {string} [url]
* @returns {string}
*/
export function ensureHttpsUrl(url) {
if (!url) return ''
const str = String(url).trim()
if (!str) return ''
return str.replace(/^http:/, 'https:')
}