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 | 节流等待时间 | number | 0 |
debounceWait | 防抖等待时间 | number | 0 |