Skip to content
On this page

Button 按钮

简介

相比于 ElButton,添加了防抖、节流

防抖

点击0次

<template>
  <CxzButton type="primary" :debounce-wait="2000" @click="handleClick">
    防抖按钮
  </CxzButton>
  <div>点击{{ count }}次</div>
</template>

<script setup lang="ts">
import { CxzButton } from 'cxz-ui'
import { ref } from 'vue'

const count = ref(0)

const handleClick = () => {
  count.value++
}
</script>

节流

点击0次

<template>
  <CxzButton type="primary" :throttle-wait="2000" @click="handleClick">
    节流按钮
  </CxzButton>
  <div>点击{{ count }}次</div>
</template>

<script setup lang="ts">
import { CxzButton } from 'cxz-ui'
import { ref } from 'vue'

const count = ref(0)

const handleClick = () => {
  count.value++
}
</script>

Button 新增属性

属性名说明类型默认值
throttleWait节流等待时间number0
debounceWait防抖等待时间number0

Released under the MIT License.