docs: annotate all shared frontend modules in Chinese
This commit is contained in:
1 parent
2be21c1c62
commit
408f8e5c98
55 files changed
+349
No files matched your search
@@ -1,5 +1,7 @@
|
||||
/** 官网 CMS 内容状态与安全展示辅助;默认文案是页面占位,不是实时资源/业绩数据。 */
|
||||
import { useState } from "#app";
|
||||
import { useApi } from "~/lib/auth.js";
|
||||
// 默认评价隐藏,未填写的联系方式/备案不虚构;实际内容由 CMS 接口覆盖。
|
||||
var n = {
|
||||
meta: {
|
||||
title: `破碎工坊网络 - 云计算与基础设施服务`,
|
||||
@@ -342,6 +344,7 @@ var n = {
|
||||
function r(e) {
|
||||
return typeof e == `object` && !!e && !Array.isArray(e);
|
||||
}
|
||||
// 对象递归合并缺省值,数组整体替换,避免 CMS 删除条目后又被默认数组补回。
|
||||
function i(e, t) {
|
||||
if (Array.isArray(e)) return Array.isArray(t) ? t : e;
|
||||
if (!r(e)) return t === void 0 ? e : t;
|
||||
@@ -352,12 +355,14 @@ function i(e, t) {
|
||||
for (let [t, r] of Object.entries(n)) a[t] = t in e ? i(e[t], r) : r;
|
||||
return a;
|
||||
}
|
||||
// useState 初始化时使用深拷贝,页面编辑不会修改模块内的默认文案。
|
||||
function a() {
|
||||
return JSON.parse(JSON.stringify(n));
|
||||
}
|
||||
function o(e) {
|
||||
return i(n, e);
|
||||
}
|
||||
// 链接允许站内路径、锚点、HTTP(S)/mailto/tel;未知协议和反斜杠回落为不可跳转的 #。
|
||||
function s(e) {
|
||||
if (typeof e != `string`) return `#`;
|
||||
let t = e.trim();
|
||||
@@ -367,6 +372,7 @@ function s(e) {
|
||||
? t
|
||||
: `#`;
|
||||
}
|
||||
// 图片来源比链接更严格,不允许 mailto/tel、data 或协议相对 URL。
|
||||
function c(e) {
|
||||
if (typeof e != `string`) return ``;
|
||||
let t = e.trim();
|
||||
@@ -376,14 +382,17 @@ function c(e) {
|
||||
? t
|
||||
: ``;
|
||||
}
|
||||
// 主题颜色只接受六位十六进制值,非法 CMS 值使用调用方给出的默认色。
|
||||
function l(e, t) {
|
||||
return typeof e == `string` && /^#[0-9a-fA-F]{6}$/.test(e) ? e : t;
|
||||
}
|
||||
// 一般加载共享在途 Promise;显式强制刷新可重新请求,失败保留默认/既有内容。
|
||||
var u = null;
|
||||
function d() {
|
||||
let n = useState(`official-site-content`, a),
|
||||
r = useState(`official-site-content-loaded`, () => !1),
|
||||
i = useState(`official-site-content-error`, () => ``);
|
||||
// loaded 表示本轮尝试已结束(含失败);错误单独暴露,避免布局挂载后无限重试。
|
||||
async function s(e = !1) {
|
||||
return r.value && !e
|
||||
? n.value
|
||||
|
||||
Reference in new issue
Block a user