iter(g266): 新增 JSON 树查看组件

This commit is contained in:
HIsheR
2026-10-26 22:50:05 +08:00
parent e2fb02f40e
commit 90bd60e0cf
12 changed files with 293 additions and 11 deletions
+16
View File
@@ -31,6 +31,7 @@ import {
countdown,
dataTable,
layout,
jsonViewer,
kbd,
highlight,
datePicker,
@@ -1723,6 +1724,21 @@ const content = h(
),
),
),
section(
'sec-jsonviewer',
'JSON 树查看',
'jsonViewer:接口返回的原始对象直接丢进去即可——默认展开两层、分支显示「N 项 / N 个键」,叶子按类型着色;只读,不带编辑。',
jsonViewer({
value: {
code: 0,
message: 'ok',
data: { total: 3, page: 1, items: users.slice(0, 3).map((u) => ({ id: u.id, name: u.name, city: u.city, tags: ['活跃'], vip: u.id === 1 })) },
},
rootLabel: 'response',
depth: 2,
maxHeight: 260,
}),
),
);
// 悬浮按钮:fixed 定位,挂 body 不参与页面布局