iter(e04): 新增 empty 空状态组件
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
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;
|
||||
}
|
||||
@@ -26,6 +26,7 @@ export { progress } from './progress.js';
|
||||
export { tabs } from './tabs.js';
|
||||
export { stepper } from './stepper.js';
|
||||
export { rate } from './rate.js';
|
||||
export { empty } from './empty.js';
|
||||
export { modal } from './modal.js';
|
||||
export { drawer } from './drawer.js';
|
||||
export { form, formItem } from './form.js';
|
||||
|
||||
@@ -197,6 +197,13 @@ export interface RateProps {
|
||||
onChange?: (value: number) => void; // 评分变化回调
|
||||
}
|
||||
|
||||
/*** 空状态入参 ***/
|
||||
export interface EmptyProps {
|
||||
title?: string; // 主标题;缺省不渲染
|
||||
description?: string; // 补充说明;缺省不渲染
|
||||
action?: unknown; // 操作区内容(常见为按钮);缺省不渲染
|
||||
}
|
||||
|
||||
/*** 徽标入参 ***/
|
||||
export interface BadgeProps {
|
||||
label: string; // 徽标文案
|
||||
|
||||
Reference in New Issue
Block a user