Skip to content

Button组件

<template>
  <div class="basic block">
    <open-button> Default </open-button>
    <open-button type="primary"> Primary </open-button>
    <open-button type="info"> Info </open-button>
    <open-button type="success"> Success </open-button>
    <open-button type="warning"> Warning </open-button>
    <open-button type="danger"> Danger </open-button>
  </div>

  <div class="plain block">
    <open-button plain> Plain </open-button>
    <open-button type="primary" plain> Primary </open-button>
    <open-button type="info" plain> Info </open-button>
    <open-button type="success" plain> Success </open-button>
    <open-button type="warning" plain> Warning </open-button>
    <open-button type="danger" plain> Danger </open-button>
  </div>

  <div class="round block">
    <open-button round> Round </open-button>
    <open-button type="primary" round> Primary </open-button>
    <open-button type="info" round> Info </open-button>
    <open-button type="success" round> Success </open-button>
    <open-button type="warning" round> Warning </open-button>
    <open-button type="danger" round> Danger </open-button>
  </div>

  <div class="circle block">
    <open-button circle :icon="Search" />
    <open-button type="primary" circle :icon="Share" />
    <open-button type="success" circle :icon="Delete" />
    <open-button type="warning" circle :icon="Star" />
    <open-button type="danger" circle :icon="Close" />
    <open-button type="info" circle :icon="Monitor" />
  </div>
</template>
<script setup>
import OpenButton from '@open-design/components/button';
import { Close, Delete, Monitor, Search, Share, Star } from '@element-plus/icons-vue';
</script>
<style>
.block {
  margin-bottom: 10px;
}
</style>

API

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