Skip to content

Button 按钮

常用的操作按钮。

基础用法

使用 typeplainroundcircle 来定义按钮的样式。

<script setup>
import KButton from "@/components/Button/Button.vue";
</script>
<template>
  <div class="mb-4">
    <k-button> hello </k-button>
    <k-button type="primary"> Primary </k-button>
    <k-button type="warning"> Warning </k-button>
    <k-button type="danger"> Danger </k-button>
    <k-button loading> Loading </k-button>
  </div>
  <div class="mb-4">
    <k-button plain round> hello </k-button>
    <k-button type="primary" round> Primary </k-button>
    <k-button type="warning" round> Warning </k-button>
    <k-button type="danger" round> Danger </k-button>
    <k-button loading round> Loading </k-button>
  </div>
  <div>
    <k-button type="primary" icon="edit" circle></k-button>
    <k-button type="success" icon="check" circle></k-button>
    <k-button type="info" icon="message" circle></k-button>
    <k-button type="warning" icon="star" circle></k-button>
    <k-button type="danger" icon="trash-can" circle></k-button>
  </div>
</template>

Button Attributes

NameDescriptionTypeDefault
sizebutton sizeenum - 'large'| 'small'
typebutton typeenum - 'primary'| 'success'| 'warning'| 'danger'| 'info'
plaindetermine whether it's a plain buttonbooleanfalse
rounddetermine whether it's a round buttonbooleanfalse
circledetermine whether it's a circle buttonbooleanfalse
loadingdetermine whether it's loadingbooleanfalse
disableddisable the buttonbooleanfalse
iconicon componentstring
autofocussame as native button's autofocusbooleanfalse
native-typesame as native button's typeenum - 'button'| 'submit'| 'reset'button