v0.10.27: /product/$slug 产品单模板一比一(模板2741/29972 补录、Woo 图廊/meta/tabs/相关产品组件、page_css 130 篇、动态按钮落地)+ css-translate 共享模块

This commit is contained in:
bigcode
2026-11-03 05:18:10 +08:00
parent d016be03ae
commit 35d154870a
9 changed files with 472 additions and 277 deletions
+8
View File
@@ -21,6 +21,14 @@ const dirCache = new Map<string, string[]>();
/** # 成员变量 变体解析结果缓存(url+size → 最终 url) **/
const resultCache = new Map<string, string>();
/** # 函数 对外:媒体 URL 的 WP 尺寸变体解析(服务端;无变体返回原 URL)
* 参数 url 原图 URL;targetWidth WP 档位目标宽(150/300/600/768/1024)
*/
export function resolveMediaVariantUrl(url: string, targetWidth: number): string {
if (typeof window !== "undefined" || !url?.includes("/uploads/")) return url;
return findVariant(url, targetWidth) ?? url;
}
/** # 函数 查找某原图在给定目标宽度下的最佳变体 URL(无则返回 null)
* 参数 url 原图 URL(本地 /uploads/... 或原站绝对地址);targetWidth WP 档位目标宽
*/