Skip to content

Button 按钮

按钮类型

html
<vz-button type="primary">主要按钮</vz-button>
html
<vz-button type="success">成功按钮</vz-button>
html
<vz-button type="warning">警告按钮</vz-button>
html
<vz-button type="danger">危险按钮</vz-button>
html
<vz-button type="info">信息按钮</vz-button>

镂空按钮

html
<vz-button type="primary" plain>主要按钮</vz-button>
html
<vz-button type="success" plain>成功按钮</vz-button>
html
<vz-button type="warning" plain>警告按钮</vz-button>
html
<vz-button type="danger" plain>危险按钮</vz-button>
html
<vz-button type="info" plain>信息按钮</vz-button>

按钮形状

html
<vz-button type="primary" square>方形按钮</vz-button>
html
<vz-button type="success" round plain>圆形按钮</vz-button>

禁用状态

html
<vz-button disabled>禁用状态</vz-button>
html
<vz-button type="success" disabled plain>禁用状态</vz-button>

加载状态

html
<vz-button loading loading-text="加载中...">加载状态</vz-button>
html
<vz-button type="success" loading loading-name="spinner" loading-text="加载中..." plain>加载状态</vz-button>

图标按钮

html
<vz-button icon="vz-icon-home">按钮</vz-button>
html
<vz-button type="success" plain icon="vz-icon-home"></vz-button>
html
<vz-button icon="vz-icon-home" circle></vz-button>

自定义颜色

html
<vz-button color="violet">单色按钮</vz-button>

<vz-button plain color="teal">单色按钮</vz-button>

<vz-button color="linear-gradient(to right, teal, violet)">渐变色按钮</vz-button>
html
<vz-button disabled color="violet">单色按钮</vz-button>

<vz-button disabled plain color="teal">单色按钮</vz-button>

<vz-button disabled color="linear-gradient(to right, teal, violet)">渐变色按钮</vz-button>
html
<vz-button loading loading-text="加载中" color="violet">单色按钮</vz-button>

<vz-button loading loading-text="加载中" plain color="teal">单色按钮</vz-button>

<vz-button loading loading-text="加载中" color="linear-gradient(to right, teal, violet)">渐变色按钮</vz-button>

自定义尺寸

html
<vz-button type="primary" block>块级元素</vz-button>

<vz-button type="success" width="80%" height="100rpx" block>自定义尺寸</vz-button>

<vz-button type="primary">普通按钮</vz-button>

<vz-button type="success" height="50" px="10">小型按钮</vz-button>

<vz-button type="danger" height="40" px="6" text-size="12px">迷你按钮</vz-button>

Props

属性名说明类型默认值
type按钮类型primary / success / danger / warning / infoprimary
block是否为块级元素booleanfalse
color按钮颜色string-
plain是否为镂空按钮booleanfalse
square是否为方角按钮booleanfalse
round是否为圆角按钮booleanfalse
circle是否为圆形按钮(为 true 时文本不显示)booleanfalse
px左右边距(padding-x)string / number20rpx
width宽(块级元素默认 100%)string / numberauto
heightstring / number--vz-height-base
icon按钮的图标string-
text-size图标与文字大小string / number--vz-font-size-base
gap图标与文字之间的间距string / number--vz-gap-base
disabled是否为禁用状态booleanfalse
loading是否为加载中状态booleanfalse
loading-name加载中图标circular / spinner / icon-
loading-text加载中文案string-
i-class根节点样式类string-
i-style根节点样式Vue.StyleValue-

uniapp

Events

事件名说明参数
click点击事件-

Slots

插槽名说明
default按钮内容

CSS

变量名说明默认值
--vz-button-pxprops.px20rpx
--vz-button-widthprops.width-
--vz-button-heightprops.height--vz-height-base
--vz-button-text-sizeprops.textSize--vz-font-size-base
--vz-button-gapprops.gap--vz-gap-base
--vz-button-font-weight文字加粗500
--vz-button-radius圆角--vz-border-radius-base

SCSS

scss
$button: (
  "px": 20rpx,
  "height": var(--vz-height-base),
  "border": var(--vz-border),
  "radius": var(--vz-border-radius-base),
  "font-weight": 500,
  "text-size": var(--vz-font-size-base),
  "gap": var(--vz-gap-base),
);