fix(carousel): fix navigate to current item (#302)

* fix(carousel): fix carousel click triggering button bug

* Apply suggestions from code review

Co-authored-by: 07akioni <07akioni2@gmail.com>
This commit is contained in:
XieZongChen 2021-06-27 15:59:34 +08:00 committed by GitHub
parent 4401d4954f
commit 3d48a7c711
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View File

@ -16,6 +16,7 @@
- Fix `n-date-picker` `n-provider` pass `date-locale` not work, closes [#250](https://github.com/TuSimple/naive-ui/issues/250).
- Fix `n-input` clear button placeholder prevent clicking on actual component [#288](https://github.com/TuSimple/naive-ui/issues/288)
- Fix `n-carousel` click the at current item button, the component behaves abnormally.
## 2.14.0 (2021-06-23)

View File

@ -16,6 +16,7 @@
- 修复 `n-date-picker` `n-provider` 传递 `date-locale` 属性无效,关闭 [#250](https://github.com/TuSimple/naive-ui/issues/250)
- Fix `n-input` clear button placeholder prevent clicking on actual component [#288](https://github.com/TuSimple/naive-ui/issues/288)
- 修复 `n-carousel` 点击当前页对应的控制按钮时,组件显示异常
## 2.14.0 (2021-06-23)

View File

@ -60,8 +60,9 @@ export default defineComponent({
function setCurrent (value: number): void {
if (lengthRef.value <= 1) return
if (inTransition) return
inTransition = true
const { value: current } = currentRef
if (value === current) return
inTransition = true
if (current === 1 && value === lengthRef.value && value - current > 1) {
currentRef.value--
} else if (