Button 按钮 
常用的操作按钮。
基础用法 
使用 type、plain、 round和 circle来定义按钮的样式。
<template>
  <p>
    <x-button>Default</x-button>
    <x-button type="primary">Primary</x-button>
    <x-button type="success">Success</x-button>
    <x-button type="info">Info</x-button>
    <x-button type="warning">Warning</x-button>
    <x-button type="danger">Danger</x-button>
  </p>
  <p>
    <x-button plain>Plain</x-button>
    <x-button type="primary" plain>Primary</x-button>
    <x-button type="success" plain>Success</x-button>
    <x-button type="info" plain>Info</x-button>
    <x-button type="warning" plain>Warning</x-button>
    <x-button type="danger" plain>Danger</x-button>
  </p>
  <p>
    <x-button round>Round</x-button>
    <x-button type="primary" round>Primary</x-button>
    <x-button type="success" round>Success</x-button>
    <x-button type="info" round>Info</x-button>
    <x-button type="warning" round>Warning</x-button>
    <x-button type="danger" round>Danger</x-button>
  </p>
  <p>
    <x-button icon="search" circle />
    <x-button type="primary" icon="edit" circle />
    <x-button type="success" icon="check" circle />
    <x-button type="info" icon="message" circle />
    <x-button type="warning" icon="star" circle />
    <x-button type="danger" icon="trash" circle />
  </p>
</template>禁用状态 
你可以使用 disabled 属性来定义按钮是否被禁用。
<template>
  <p>
    <x-button>Default</x-button>
    <x-button type="primary">Primary</x-button>
    <x-button type="success">Success</x-button>
    <x-button type="info">Info</x-button>
    <x-button type="warning">Warning</x-button>
    <x-button type="danger">Danger</x-button>
  </p>
  <p>
    <x-button disabled>Default</x-button>
    <x-button type="primary" disabled>Primary</x-button>
    <x-button type="success" disabled>Success</x-button>
    <x-button type="info" disabled>Info</x-button>
    <x-button type="warning" disabled>Warning</x-button>
    <x-button type="danger" disabled>Danger</x-button>
  </p>
</template>图标按钮 
使用 icon属性来定义按钮的图标。
<template>
  <div>
    <x-button type="primary" icon="edit" />
    <x-button type="primary" icon="share" />
    <x-button type="primary" icon="trash" />
    <x-button type="primary" icon="search">Search</x-button>
    <x-button type="primary">
      Upload<x-icon icon="upload" style="margin-left: 8px" />
    </x-button>
  </div>
</template>按钮组 
使用 <er-button-group> 对多个按钮分组。
<template>
  <p>
    <x-button-group disabled>
      <x-button type="primary" icon="arrow-left">Previous Page</x-button>
      <x-button type="primary">
        Next Page<x-icon icon="arrow-right" style="margin-left: 8px" />
      </x-button>
    </x-button-group>
  </p>
  <p>
    <x-button-group type="warning" size="small">
      <x-button type="primary" icon="edit" round />
      <x-button type="primary" icon="share" />
      <x-button type="primary" icon="trash" round />
    </x-button-group>
  </p>
</template>加载状态 
使用 loading属性来定义按钮的加载状态。
TIP
您可以使用 loading 插槽或 loadingIcon 属性自定义您的 loading 图标
ps: loading 插槽优先级高于 loadingIcon 属性
<template>
  <div>
    <x-button type="primary" loading>Loading</x-button>
    <x-button type="primary" loading-icon="circle-notch" loading
      >Loading</x-button
    >
    <x-button type="primary" loading>
      <template #loading>
        <x-icon style="margin-right: 6px" icon="star" spin />
      </template>
      Loading
    </x-button>
  </div>
</template>按钮尺寸 
使用 size属性来定义按钮的尺寸。
<template>
  <p>
    <x-button size="large">Large</x-button>
    <x-button>Default</x-button>
    <x-button size="small">Small</x-button>
    <x-button size="large" icon="search">Search</x-button>
    <x-button icon="search">Search</x-button>
    <x-button size="small" icon="search">Search</x-button>
  </p>
  <p>
    <x-button size="large" round>Large</x-button>
    <x-button round>Default</x-button>
    <x-button size="small" round>Small</x-button>
    <x-button size="large" icon="search" round>Search</x-button>
    <x-button icon="search" round>Search</x-button>
    <x-button size="small" icon="search" round>Search</x-button>
  </p>
  <p>
    <x-button size="large" icon="search" circle />
    <x-button icon="search" circle />
    <x-button size="small" icon="search" circle />
  </p>
</template>Tag 
可以自定义元素标签。例如,按钮,div,路由链接,nuxt 链接。
<template>
  <x-button>button</x-button>
  <x-button tag="div" role="button" tabindex="0">div</x-button>
  <x-button
    type="primary"
    tag="a"
    href="https://github.com/EricWXY/eric-ui"
    target="_blank"
    rel="noopener noreferrer"
  >
    a
  </x-button>
</template>节流模式 
可以通过 useThrottle 属性来定义按钮是否使用节流模式 默认为 true。
<script setup>
function handleBtnClick() {
  console.log('btn click')
}
</script>
<template>
  <p>
    <x-button @click="handleBtnClick"> with throttle</x-button>
    <x-button :use-throttle="false" @click="handleBtnClick"
      >without throttle</x-button
    >
  </p>
</template>Button API 
Props 
| Name | Description | Type | Default | 
|---|---|---|---|
| size | 尺寸 | enum-'large'| 'default'| 'small' | — | 
| type | 类型 | enum-'primary'| 'success'| 'warning'| 'danger'| 'info' | info | 
| plain | 是否为朴素按钮 | boolean | false | 
| round | 是否为圆角按钮 | boolean | false | 
| circle | 是否为圆形按钮 | boolean | false | 
| loading | 是否为加载中状态 | boolean | false | 
| loading-icon | 自定义加载中状态图标组件 | string | spinner | 
| disabled | 按钮是否为禁用状态 | boolean | false | 
| icon | 按钮图标 | string | - | 
| autofocus | 是否自动聚焦(原生 autofocus属性) | boolean | false | 
| native-type | 原生 type 属性 | enum-'button'| 'submit'| 'reset' | button | 
| tag | 自定义元素标签 | string/Component | button | 
| use-throttle | 是否使用节流模式 | boolean | true | 
| throttle-duration | 节流模式下,节流时间间隔(ms) | number | 500 | 
Events 
| Name | Description | Type | 
|---|---|---|
| click | 按钮点击事件 | (event: MouseEvent)=> void | 
Slots 
| Name | Description | 
|---|---|
| default | 默认插槽, 按钮内容 | 
| loading | 自定义加载图标 | 
Expose 
| Name | Description | Type | 
|---|---|---|
| ref | 按钮 html 元素 | Ref<HTMLButtonElement> | 
| size | 按钮尺寸 | ComputedRef<''|'small' |'large'> | 
| type | 按钮类型 | ComputedRef<''|'primary' |...> | 
| disabled | 按钮禁用状态 | ComputedRef<boolean> | 
ButtonGroup API 
Props 
| Name | Description | Type | Default | 
|---|---|---|---|
| size | 尺寸 | enum-'large'| 'default'| 'small' | — | 
| type | 类型 | enum-'primary'| 'success'| 'warning'| 'danger'| 'info' | info | 
| disabled | 按钮组是否为禁用状态 | boolean | false | 
Slots 
| Name | Description | Sub Component | 
|---|---|---|
| default | 默认插槽 | Button |