旋转边框按钮

-

一个具有旋转边框动画效果的按钮组件。

基础用法

vue
<RotateBorderButton text="点击按钮" type="primary" />
loading

属性说明

属性名说明类型可选值默认值
text按钮文本String-'button'
type按钮类型Stringprimary/info/success
/warning/danger/default
'primary'
size按钮尺寸Stringlarge/default/small'default'
width按钮宽度String--
height按钮高度String--
disabled是否禁用Booleantrue/falsefalse
loading是否显示加载状态Booleantrue/falsefalse
backgroundColor按钮背景色String-'#ffffff'

插槽

插槽名说明
icon按钮图标插槽

事件

事件名说明回调参数
click点击按钮时触发(在禁用或加载状态下不会触发)-

尺寸大小 size

提供三种尺寸

large/default/small,通过size属性来设置

vue
<RotateBorderButton size="large" text="大型按钮" />
<RotateBorderButton size="default" text="默认按钮" />
<RotateBorderButton size="small" text="小型按钮" />
loading

按钮类型 type

提供六种类型

primary/info/success/warning/danger/default,通过type属性来设置

vue
<RotateBorderButton size="large" text="大型按钮" />
<RotateBorderButton size="default" text="默认按钮" />
<RotateBorderButton size="small" text="小型按钮" />
loading

加载状态 loading

TIP

设置loading属性为true时,按钮会显示加载状态

vue
<RotateBorderButton text="加载中" type="primary" :loading="true" />
loading

禁用状态 disabled

TIP

设置disabled属性为true时,按钮会显示禁用状态

vue
<RotateBorderButton text="禁用" type="danger" :disabled="true" />
loading

自定义图标 icon

TIP

通过icon插槽来自定义图标

html
<RotateBorderButton type="warning" text="带图标的按钮">
  <template #icon>
    <el-icon size="15">
      <Edit />
    </el-icon>
  </template>
</RotateBorderButton>
loading

自定义背景色 backgroundColor

TIP

通过backgroundColor属性来自定义按钮背景色

vue
<RotateBorderButton type="danger" text="自定义背景" backgroundColor="#6bc09c" />
loading

自定义尺寸 width/height

可以通过 widthheight 属性设置按钮的具体尺寸:

TIP

通过 widthheight 属性设置按钮的具体尺寸

vue
<RotateBorderButton text="自定义尺寸" width="200px" height="50px" />
loading

特性

  • 具有旋转边框动画效果
  • 支持多种类型和尺寸
  • 支持加载状态显示
  • 支持自定义图标
  • 支持禁用状态
  • 支持自定义背景色
  • 支持自定义宽高
  • 支持点击事件
  • 响应式动画过渡效果

注意事项

  1. 按钮的 type 属性会影响按钮的颜色主题
  2. 禁用状态或加载状态下按钮不会触发 click 事件
  3. 自定义宽高时需要传入带单位的字符串值(如:'100px')
  4. 加载状态会显示一个旋转的加载图标
  5. 当使用图标插槽时,图标与文本之间会自动添加间距
  6. 背景色可以通过 backgroundColor 属性自定义,支持任何有效的 CSS 颜色值