Skip to content

Latest commit

 

History

History
104 lines (81 loc) · 2.46 KB

Button.mdx

File metadata and controls

104 lines (81 loc) · 2.46 KB
title
Button 按钮

示例

import { Button } from '@tarojsx/ui'; import { Image } from '@tarojs/components'; import useBaseUrl from '@docusaurus/useBaseUrl'; import dayjs from 'dayjs'; import { UI } from '@/ui';

<Button>default</Button>

<Button type="primary">primary</Button>

<Button type="secondary">secondary</Button>

<Button type="warn">warn</Button>

<Button type="error">error</Button>
default primary secondary warn error
<Button size="mini">mini</Button>

<Button size="small">small</Button>
mini small
<Button transparent openType="getUserInfo">
  <Image src={useBaseUrl('img/logo.svg')} />
</Button>

<UI style={{ display: 'inline-block' }}> <Image src={useBaseUrl('img/logo.svg')} />

<Button clickThrottle>快速点我!</Button>
{() => { const [times, setTimes] = React.useState([]); return ( <> setTimes((prev) => [dayjs(), ...prev.slice(0, 4)])}> 快速点我! {times.map((time, index) => (
{time.format(`ss' SSS''`)}
))} ); }}

API

参数 说明 类型 默认值
type 类型 default primary secondary warn error
size 尺寸 default normal small mini
clickThrottle onClick 事件节流时间间隔, 单位: ms. boolean number 500ms
transparent 透明按钮. boolean