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

[New Feature] 为 slide 提供一个初始位置 #1175

Closed
FanKaiqiang opened this issue Apr 13, 2021 · 3 comments · May be fixed by Wangcongg/vue-netease-music#5
Closed

[New Feature] 为 slide 提供一个初始位置 #1175

FanKaiqiang opened this issue Apr 13, 2021 · 3 comments · May be fixed by Wangcongg/vue-netease-music#5

Comments

@FanKaiqiang
Copy link

What problem does this feature solve?

图片全屏轮播场景常常不是从第一张图片开始播放,如果要实现从中间的某张图开始播放,就比较麻烦了。若可以提供一个类似startX的配置项,可以设置slide的初始pageIndex,将会方便很多

What does the proposed API look like?

const slide = new BScroll(this.$refs.slide, {
    scrollX: true,
    scrollY: false,
    slide: {
        loop: true,
        autoplay: false,
        startIndex: 5,
    },
    momentum: false,
    bounce: false
})
@theniceangel
Copy link
Collaborator

麻烦倒是不麻烦,直接在实例化 bs 之后,调用 goToPage 方法即可,不过内置参数比较好

@FanKaiqiang
Copy link
Author

麻烦倒是不麻烦,直接在实例化 bs 之后,调用 goToPage 方法即可,不过内置参数比较好

之前我以为实例化 bs 之后调用直接goToPage会有在首屏时是在第一页,然后再切换成startIndex的效果,所以也没有试过。

刚才试了好像确实可以,如果有内置参数的话就更好了,现在用这种方式有点出乎意料的感觉。多谢了。

@theniceangel
Copy link
Collaborator

fixed at v2.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants