docs: explain navigation, search and content components

This commit is contained in:
cieanyau committed 2026-11-06 00:37:46 +08:00
1 parent 2ff311005e
commit 179c6febf0
10 files changed
+34

No files matched your search

+6
View File
@@ -1,4 +1,5 @@
<script>
// 安全展示商品介绍:简单的“标签:内容”转为信息块,复杂排版保留清洗后的富文本。
import "~/assets/styles/ProductDescription.Ctb7jDuO.css";
import { toDisplayString } from "vue";
import { renderList } from "vue";
@@ -100,6 +101,7 @@ var v = {
function S(e) {
return /<\/?[a-z][^>]*>|<!doctype\b[^>]*>|<!--/i.test(e);
}
// 处理历史数据中的实体编码,最多解码两轮,遇到实际 HTML 后停止继续解码。
function C(e) {
let t = e;
for (
@@ -117,6 +119,7 @@ function C(e) {
}
return t;
}
// 按块级元素、换行和表格单元格边界提取文本,避免直接 textContent 丢失段落结构。
function w(e, t, n = ``) {
let r = ``;
function i() {
@@ -166,6 +169,7 @@ function w(e, t, n = ``) {
)
.trim();
}
// 仅允许无属性的简单标签转成字段块;带格式或不符合标签语义的内容保留富文本。
function T(e, t) {
for (let n of Array.from(e.querySelectorAll(`*`))) {
let r = n.localName;
@@ -192,6 +196,7 @@ function T(e, t) {
}
return !0;
}
// 先做 HTML 清洗,再判断空内容与呈现模式;图片即使没有正文也不能被判为空。
function E(e) {
if (typeof e != `string` || !e.trim())
return {
@@ -311,6 +316,7 @@ var D = [`aria-label`],
v.value = !1;
},
);
// 以 Unicode 码点截断紧凑摘要,避免把代理对字符从中间切开。
function b(e, t) {
let n = Array.from(e);
return n.length > t ? `${n.slice(0, t).join(``)}…` : e;