iter(e04): 新增 empty 空状态组件
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
checkbox,
|
||||
dataTable,
|
||||
drawer,
|
||||
empty,
|
||||
form,
|
||||
formItem,
|
||||
inputNumber,
|
||||
@@ -123,6 +124,9 @@ const stepIdx = signal(0);
|
||||
// —— 评分:满意度演示,与只读实例共用同一信号 ——
|
||||
const score = signal(0);
|
||||
|
||||
// —— 空状态:搜索无结果演示 ——
|
||||
const noResult = signal(true);
|
||||
|
||||
// —— 受控选中:dataTable 内部勾选实时写回,外部可清空 ——
|
||||
const picked = signal<RowKey[]>([]);
|
||||
|
||||
@@ -379,6 +383,20 @@ const content = h(
|
||||
),
|
||||
h('div', { class: 'row' }, rate({ value: score, disabled: true })),
|
||||
),
|
||||
section(
|
||||
'sec-empty',
|
||||
'空状态',
|
||||
'empty:无数据 / 无结果的统一占位,action 放引导按钮,点击按钮切回有数据态可对比。',
|
||||
h('div', { class: 'row' }, h('span', { class: 'out' }, () => (noResult() ? '当前:无结果' : '当前:有数据'))),
|
||||
h(
|
||||
'div',
|
||||
{ class: 'row' },
|
||||
button({ label: '切换数据态', onClick: () => noResult(!noResult()) }),
|
||||
),
|
||||
() => (noResult()
|
||||
? empty({ title: '暂无匹配结果', description: '试试放宽筛选条件,或清空关键词重新搜索。', action: button({ label: '重置筛选', variant: 'ghost', onClick: () => noResult(false) }) })
|
||||
: card({ title: '搜索结果' }, h('p', null, '这里展示命中的数据列表。'))),
|
||||
),
|
||||
section(
|
||||
'sec-menu',
|
||||
'下拉菜单',
|
||||
|
||||
Reference in New Issue
Block a user