wuui
  • README
  • 开发指南
    • 介绍
    • 快速上手
    • 定制主题
  • 基础组件
    • Button 按钮
    • Cell 单元格
    • Icon 图标
    • Image 图片
    • Popup 弹出层
    • Toast 轻提示
  • 表单组件
    • Checkbox 复选框
    • Field 输入框
    • Form 表单
    • Search 搜索
    • Signature 签名
    • Stepper 步进器
  • 导航组件
    • BackTop 回到顶部
    • Grid 宫格
    • NavBar 导航栏
  • 展示组件
    • CountDown 倒计时
    • Divider 分割线
    • Empty 空状态
    • Splash 过渡页
    • Tag 标签
  • 反馈组件
    • Loading 加载
    • SwipeCell 滑动单元格
  • 业务组件
    • ActionBar 商品动作栏
    • Card 商品卡片
    • SubmitBar 提交订单栏
Powered by GitBook
On this page
  • 介绍
  • 引入
  • 代码演示
  • 按钮类型
  • 朴素按钮
  • 禁用状态
  • 按钮形状
  • 按钮尺寸
  • 块级按钮
  • API
  • @Props
  1. 基础组件

Button 按钮

Previous基础组件NextCell 单元格

Last updated 7 months ago

介绍

按钮用于触发一个操作,如提交表单。

引入

import { WuButton } from '@itrain/wu-ui'

代码演示

按钮类型

按钮支持 default、primary、success、warning、danger 五种类型,默认为 default。

WuButton({ type: 'primary', text: '主要按钮' })
WuButton({ type: 'success', text: '成功按钮' })
WuButton({ type: 'default', text: '默认按钮' })
WuButton({ type: 'danger', text: '危险按钮' })
WuButton({ type: 'warning', text: '警告按钮' })

朴素按钮

通过 plain 属性将按钮设置为朴素按钮,朴素按钮的文字为按钮颜色,背景为白色。

WuButton({ type: 'primary', plain: true, text: '朴素按钮' })
WuButton({ type: 'success', plain: true, text: '朴素按钮' })
WuButton({ type: 'danger', plain: true, text: '朴素按钮' })

禁用状态

通过 disabled 属性来禁用按钮,禁用状态下按钮不可点击。

WuButton({ type: 'primary', text: '禁用状态', disabled: true })
WuButton({ type: 'success', text: '禁用状态', disabled: true })
WuButton({ type: 'danger', text: '禁用状态', disabled: true })

按钮形状

通过 square 设置方形按钮,通过 round 设置圆形按钮。

WuButton({ type: 'primary', text: '方形按钮', shape: 'square' })
WuButton({ type: 'success', text: '圆形按钮', shape: 'round' })

按钮尺寸

支持 huge、 large、normal、small、mini 五种尺寸,默认为 normal。

WuButton({ type: 'primary', text: '超大号按钮', btnSize: 'huge' })
WuButton({ type: 'primary', text: '大号按钮', btnSize: 'large' })
WuButton({ type: 'primary', text: '普通按钮', btnSize: 'normal' })
WuButton({ type: 'primary', text: '小号按钮', btnSize: 'small' })
WuButton({ type: 'primary', text: '迷你按钮', btnSize: 'mini' })

块级按钮

通过 block 属设置块级按钮,使其占据100%的容器宽度。

WuButton({ type: 'primary', text: '超大号按钮', btnSize: 'huge', block: true })

API

@Props

名称
说明
类型
是否必需
默认值

type

类型, 可选值为 primary、success、 warning、danger、default

string

否

'default'

text

按钮文字

ResourceStr

否

'按钮'

shape

按钮形状, 可选值为 round 与 square

string

否

'square'

btnSize

尺寸, 可选值为 large、small、mini、normal、huge

string

否

'normal'

plain

是否为朴素按钮

boolean

否

false

disabled

是否禁用按钮

boolean

否

false

block

是否块级按钮

boolean

否

false

type