ant-design-vue
ant-design-vue copied to clipboard
slider组件的afterChange会触发两次
trafficstars
- [x] I have searched the issues of this repository and believe that this is not a duplicate.
Version
4.2.3
Environment
官网示例, chrome 126.0.6478.61
Reproduction link
https://next.antdv.com/components/slider-cn#components-slider-demo-event
Steps to reproduce
点击slider,再点击页面任何位置。
What is expected?
改变slider的值,afterChange事件只触发一次。
What is actually happening?
点击slider改变值之后会触发一次afterChange事件,此时在点击页面任何位置会再次触发该事件。控制台会有两次关于afterChange的输出。
我的做法是 change事件设置标志位 after-change 触发事件
<a-slider
v-model:value="value"
@afterChange="onChange"
@change="
() => {
flag = true
}
" />
<script>
let flag = false
function onChange() {
if (flag ) {
nextTick(() => {
// TODO
})
flag = false
}
}
</script>
same issue encountered. seems like a bug. but above workaround seems fine.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days