跳转到内容

Button 按钮

Button 渲染原生 <button>。type 选样式,默认为 default,主要操作可用 primary。

htmlType 决定表单行为,button 用于普通操作,submit 提交,reset 重置。省略 htmlType 时,表单里的按钮通常会触发提交。

import { Button } from '@dingshaohuax/ui-react'
export function FormActions() {
return (
<form
onSubmit={(event) => {
event.preventDefault()
alert('已触发表单提交')
}}
>
<Button htmlType="button" onClick={() => alert('预览')}>预览</Button>
<Button type="primary" htmlType="submit">保存</Button>
</form>
)
}

查看按钮演示