12 lines
469 B
TypeScript
12 lines
469 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'}`, disabled: props.disabled, onClick: props.onClick }, // false/undefined 移除属性,Signal 走响应式
|
|
props.label,
|
|
);
|
|
}
|