web-font/src/placeholders.ts
崮生(子虚) cdffd4cb57 feat: 字体列表页 + 详情页 SSG + LazyTrigger 懒加载组件
- FontList.vue: 字体列表页,卡片网格布局,支持拼音搜索,点击进入详情
- FontDetail.vue: 字体详情页,SSG 模板 + 服务端占位符替换
- LazyTrigger.vue: 可复用懒触发组件,IntersectionObserver 进入视口回调
- 首页添加字体列表入口,FontDetail 返回列表
- placeholders.ts: 前后端共享的占位符常量
- 后端 font_detail.ts: 读取 SSG 模板并替换占位符
2026-07-30 20:32:42 +08:00

28 lines
818 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* SSG 模板占位符 —— 前后端共享
*
* Vue 组件用这些常量渲染模板(SSG 产出含占位符的 HTML),
* 后端读取模板 HTML 后用 replaceAll 替换为实际值。
*
* 约定:占位符用双下划线包裹,避免和正常文本冲突。
*/
/** 字体名称占位符(如 "令东齐伋复刻体.ttf") */
export const FONT_NAME = "__FONT_NAME__";
/** 字体 slug 占位符(URL 路径部分,如 "令东齐伋复刻体.ttf") */
export const FONT_SLUG = "__FONT_SLUG__";
/** 站点 origin 占位符(如 "https://webfont.shenzilong.cn") */
export const ORIGIN = "__ORIGIN__";
/**
* 占位符 → 实际值 的映射类型
* 后端替换时传入此对象
*/
export type PlaceholderValues = {
[FONT_NAME]: string;
[FONT_SLUG]: string;
[ORIGIN]: string;
};