Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复在u-swiper中,初始化设置current无效的bug #1255

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions uview-ui/components/u-swiper/u-swiper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@
}
},
watch: {
// 如果外部的list发生变化,判断长度是否被修改,如果前后长度不一致,重置uCurrent值,避免溢出
list(nVal, oVal) {
if(nVal.length !== oVal.length) this.uCurrent = 0;
// 如果外部的list发生变化,如果uCurrent大于等于新的list的长度,重置uCurrent值,避免溢出
list(nVal) {
if(this.uCurrent >= nVal.length) this.uCurrent = 0;
},
// 监听外部current的变化,实时修改内部依赖于此测uCurrent值,如果更新了current,而不是更新uCurrent,
// 就会错乱,因为指示器是依赖于uCurrent的
Expand Down