iter(g119): 空状态支持自定义图标

This commit is contained in:
HIsheR
2026-10-26 14:12:36 +08:00
parent c67b167f44
commit 176504b6c4
7 changed files with 30 additions and 7 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
import { h } from '@ui-arch/frame';
import type { EmptyProps } from './types.js';
/*** 空状态:居中占位提示,title/description 可选,action 放操作区(常见为按钮) ***/
/*** 空状态:居中占位提示,title/description 可选,action 放操作区(常见为按钮),icon 可换成自家插图 ***/
export function empty(props: EmptyProps): HTMLDivElement {
return h(
'div',
{ class: 'ua-empty', role: 'status' }, // role=status 由读屏播报
h('div', { class: 'ua-empty-icon', 'aria-hidden': 'true' }, '⌀'), // 装饰符号,读屏跳过
h('div', { class: 'ua-empty-icon', 'aria-hidden': 'true' }, props.icon ?? '⌀'), // 装饰符号默认 ⌀,读屏跳过
props.title ? h('div', { class: 'ua-empty-title' }, props.title) : null,
props.description ? h('div', { class: 'ua-empty-desc' }, props.description) : null,
props.action ? h('div', { class: 'ua-empty-action' }, props.action) : null,