12 lines
489 B
TypeScript
12 lines
489 B
TypeScript
import { h } from '@ui-arch/frame';
|
|
import type { ButtonProps } from './types.js';
|
|
|
|
/*** 按钮:variant 控制视觉强度,disabled 支持布尔或信号禁用,onClick 为点击回调 ***/
|
|
export function button(props: ButtonProps): HTMLElement {
|
|
return h(
|
|
'button',
|
|
{ class: `ua-btn ua-btn-${props.variant ?? 'primary'}`, type: props.type ?? 'button', disabled: props.disabled, onClick: props.onClick }, // 缺省 button:表单内不隐式提交
|
|
props.label,
|
|
);
|
|
}
|