mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-02-17 13:20:52 +08:00
fix(carousel): can not stop the play onhover (#3308)
Signed-off-by: Sepush <sepush@outlook.com>
This commit is contained in:
parent
6bf10fa3c9
commit
f1e4b04257
@ -10,6 +10,7 @@
|
||||
- Fix `n-upload`'s `on-error` & `on-finish` props don't allow `() => void` type, closes [#3290](https://github.com/TuSimple/naive-ui/issues/3290).
|
||||
- Fix `n-select`'s placeholder may overflow if it's long.
|
||||
- Fix `n-input` has is no indent at the prefix if `type="textarea"` and `:autosize="true"`, closes [#3238](https://github.com/TuSimple/naive-ui/issues/3238).
|
||||
- Fix `n-carousel`'s `autoplay` prop be `true` `hover` can't stop the play, closes [#3304](https://github.com/TuSimple/naive-ui/issues/3304).
|
||||
|
||||
### Feats
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
- 修复 `n-upload` 的 `on-error` 和 `on-finish` 属性不允许 `() => void` 类型,关闭 [#3290](https://github.com/TuSimple/naive-ui/issues/3290)
|
||||
- 修复 `n-select` 的 placeholder 过长时可能溢出
|
||||
- 修复 `n-input` 在 `type="textarea"` 并且 `:autosize="true"` 时添加 prefix 后内容没有对齐,关闭 [#3238](https://github.com/TuSimple/naive-ui/issues/3238)
|
||||
- 修复 `n-carousel` 在 `autoplay` 为 `true` 时 `hover` 不停止播放,关闭 [#3304](https://github.com/TuSimple/naive-ui/issues/3304)
|
||||
|
||||
### Feats
|
||||
|
||||
|
@ -702,7 +702,16 @@ export default defineComponent({
|
||||
slideSizesRef.effect.run()
|
||||
}
|
||||
}
|
||||
|
||||
function handleMouseenter (): void {
|
||||
if (props.autoplay) {
|
||||
stopAutoplay()
|
||||
}
|
||||
}
|
||||
function handleMouseleave (): void {
|
||||
if (props.autoplay) {
|
||||
resetAutoplay()
|
||||
}
|
||||
}
|
||||
onMounted(() => {
|
||||
watchEffect(resetAutoplay)
|
||||
requestAnimationFrame(() => (isMountedRef.value = true))
|
||||
@ -831,6 +840,8 @@ export default defineComponent({
|
||||
handleTransitionEnd,
|
||||
handleResize,
|
||||
handleSlideResize,
|
||||
handleMouseenter,
|
||||
handleMouseleave,
|
||||
isActive: isDisplayActive,
|
||||
arrowSlotProps: arrowSlotPropsRef,
|
||||
dotSlotProps: dotSlotPropsRef,
|
||||
@ -897,6 +908,8 @@ export default defineComponent({
|
||||
]}
|
||||
style={this.cssVars as CSSProperties}
|
||||
{...slidesControlListeners}
|
||||
onMouseenter={this.handleMouseenter}
|
||||
onMouseleave={this.handleMouseleave}
|
||||
>
|
||||
<VResizeObserver onResize={this.handleResize}>
|
||||
{{
|
||||
|
Loading…
Reference in New Issue
Block a user