iter(g247): 表格支持整体换数据源,dataTable 可接信号数据

This commit is contained in:
HIsheR
2026-10-26 22:03:37 +08:00
parent 19741b52b6
commit 42ea31d5b5
11 changed files with 103 additions and 27 deletions
+18
View File
@@ -260,6 +260,12 @@ const resendCd = countdown({ seconds: 90, running: false, format: (s) => `重发
const highlightText = signal('数据不出端、预测低于 50ms、习惯本地学习是输入法增强系统的三条底线'); // 高亮演示原文
const highlightKw = signal('本地'); // 高亮演示关键词(与搜索框信号联动)
const demoTags = signal<string[]>(['本地推理', '隐私优先']); // 标签输入演示集合(成标签 / 删 chip 双向写回)
const tagRows = [
{ id: 'r1', name: '本地 ASR 推理', tags: ['本地推理', '隐私优先'] },
{ id: 'r2', name: '云端补全兜底', tags: ['云端'] },
{ id: 'r3', name: '习惯冷启动加速', tags: ['本地推理'] },
]; // 标签筛选演示数据:每行带 tags 供「且」关系匹配
const tagMatched = computed(() => tagRows.filter((row) => demoTags().every((tag) => row.tags.includes(tag)))); // 派生行集合:标签变化即重算,喂给 dataTable 的信号数据源
const treeChecked = signal<string[]>(['core']); // 多选树勾选集合(外部受控演示)
const treePick = signal('core'); // 树形选中节点 key
const transferKeys = signal<string[]>(['a11y']); // 穿梭框右侧集合(外部受控演示)
@@ -1168,6 +1174,18 @@ const content = h(
inputTag({ value: demoTags, max: 5, onChange: (list) => toast.info(`当前 ${list.length} 个标签`) }),
h('span', { class: 'out' }, () => `已选:${demoTags().join(' / ') || '(空)'}`),
),
h(
'div',
{ class: 'row' },
dataTable({
data: tagMatched, // 信号数据源:删标签后表格自动换源,排序 / 每页行数不被重置
columns: [
{ key: 'name', header: '能力' },
{ key: 'tags', header: '标签', format: (value) => (value as string[]).join(' / ') },
],
pageSize: 3,
}),
),
),
section(
'sec-affix',