提交 1928e8ef 编写于 作者: Q qiang

fix: 优化 swiper 组件切换方向

上级 bb29ab4f
...@@ -134,8 +134,8 @@ export default { ...@@ -134,8 +134,8 @@ export default {
current (val) { current (val) {
this._currentCheck() this._currentCheck()
}, },
currentSync (val) { currentSync (val, oldVal) {
this._currentChanged(val) this._currentChanged(val, oldVal)
this.$emit('update:current', val) this.$emit('update:current', val)
}, },
currentItemId (val) { currentItemId (val) {
...@@ -215,11 +215,12 @@ export default { ...@@ -215,11 +215,12 @@ export default {
/** /**
* 当前页面变更 * 当前页面变更
*/ */
_currentChanged (current) { _currentChanged (current, history) {
var source = this.currentChangeSource var source = this.currentChangeSource
this.currentChangeSource = '' this.currentChangeSource = ''
if (!source) { if (!source) {
this._animateViewport(current, '', 0) const length = this.items.length
this._animateViewport(current, '', this.circularEnabled && history + (length - current) % length > length / 2 ? 1 : 0)
} }
var item = this.items[current] var item = this.items[current]
if (item) { if (item) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册