Skip to content
On this page

Button 按钮

基本使用



code
vue
<template>
  <div>
    <q-button>Default</q-button>
    <q-button type="primary">Primary</q-button>
    <q-button type="success">Success</q-button>
    <q-button type="info">Info</q-button>
    <q-button type="warning">Warning</q-button>
    <q-button type="danger">Danger</q-button>
    <q-button loading>Loading</q-button>
  </div>

  <div>
    <q-button round>Default</q-button>
    <q-button type="primary" round>Primary</q-button>
    <q-button type="success" round>Success</q-button>
    <q-button type="info" round>Info</q-button>
    <q-button type="warning" round>Warning</q-button>
    <q-button type="danger" round>Danger</q-button>
  </div>

  <div>
    <q-button round>
      <q-icon name="q-icon-refresh-left" />
    </q-button>
    <q-button type="primary" round>
      <q-icon name="q-icon-delete" color="#fff" />
    </q-button>
    <q-button type="success" round>
      <q-icon name="q-icon-edit" color="#fff" />
    </q-button>
    <q-button type="info" round>
      <q-icon name="q-icon-star-off" color="#fff" />
    </q-button>
    <q-button type="warning" round>
      <q-icon name="q-icon-location" color="#fff" />
    </q-button>
    <q-button type="danger" round>
      <q-icon name="q-icon-upload" color="#fff" />
    </q-button>
  </div>
</template>

禁用状态

Code
vue
<template>
  <q-button disabled>Disabled</q-button>
</template>

尺寸

Code
vue
<template>
  <q-button size="small">Small</q-button>
  <q-button>Default</q-button>
  <q-button size="large">Large</q-button>
</template>

APIs

参数说明类型默认值必传
name默认文本stringdefaultfalse
type类型'default' | 'primary' |primaryfalse
size尺寸'small' | 'large'-false
round圆角按钮booleanfalsefalse
disabled禁用状态booleanfalsefalse
loading加载状态booleanfalsefalse

Events

事件名称说明参数
click点击按钮时的回调(e: Event) => void

License