15 lines
723 B
TypeScript
15 lines
723 B
TypeScript
import { h } from '@ui-arch/frame';
|
|
import type { EmptyProps } from './types.js';
|
|
|
|
/*** 空状态:居中占位提示,title/description 可选,action 放操作区(常见为按钮) ***/
|
|
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' }, '⌀'), // 装饰符号,读屏跳过
|
|
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,
|
|
) as HTMLDivElement;
|
|
}
|