iter(g264): 数据表格可自定义空状态文案

This commit is contained in:
HIsheR
2026-10-26 22:26:53 +08:00
parent 80671f846f
commit fe9f1fb9ec
6 changed files with 19 additions and 5 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ import type { Signal } from '@ui-arch/frame';
import { button } from './button.js';
/*** 表格空状态行:有筛选词说明是筛掉的并给一键清除,没有筛选词就是真没数据;两种语义不该混成一句话 ***/
export function emptyRow(colspan: number, keyword: Signal<string>, onClear: () => void): HTMLElement {
export function emptyRow(colspan: number, keyword: Signal<string>, onClear: () => void, emptyText = '暂无数据'): HTMLElement {
const q = keyword().trim(); // 读信号:筛选词变化时整表重绘会带上新文案
return h(
'tr',
@@ -11,7 +11,7 @@ export function emptyRow(colspan: number, keyword: Signal<string>, onClear: () =
h(
'td',
{ colspan },
h('span', { class: 'ua-empty-tip' }, q ? `没有符合「${q}」的行` : '暂无数据'),
h('span', { class: 'ua-empty-tip' }, q ? `没有符合「${q}」的行` : emptyText), // 无筛选词时用调用方文案,缺省「暂无数据」
q ? button({ label: '清除筛选', variant: 'ghost', onClick: () => { keyword(''); onClear(); } }) : null, // 清空信号与内核筛选
),
);