Skip to content

Commit

Permalink
fix: 切换数据源时,offsetLeft报错
Browse files Browse the repository at this point in the history
  • Loading branch information
warpcgd committed Aug 1, 2019
1 parent 87fb0ac commit ed0c05c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/build.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/module.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-concise-slider",
"version": "3.4.1",
"version": "3.4.2",
"repository": {
"type": "git",
"url": "[email protected]/warpcgd/vue-concise-slider.git"
Expand Down
5 changes: 3 additions & 2 deletions src/components/slider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -742,8 +742,9 @@ export default {
let slideDom = that.$el.getElementsByClassName('slider-wrapper')[0]
let children = Array.prototype.slice.call(slideDom.children)
let sliderItem = children.filter((item) => {
return item.className.indexOf('slider-item') !== -1
return item.className.indexOf('slider-item') !== -1 && item.className.indexOf('slider-copy') === -1
})
that.s_data.sliderLength = sliderItem.length || 0
if (that.s_data.sliderLength >= 1 && that.options.loop && that.options.effect !== 'fade' && that.options.effect !== 'coverflow') {
// 先清空上次添加的节点
let sliderCopy = slideDom.getElementsByClassName('slider-copy')
Expand All @@ -753,7 +754,7 @@ export default {
// debugger
let children = Array.prototype.slice.call(slideDom.children)
// 批量复制添加
sliderItem = children.filter((item) => {
let sliderItem = children.filter((item) => {
return item.className.indexOf('slider-item') !== -1
})
let length = sliderItem.length
Expand Down

0 comments on commit ed0c05c

Please sign in to comment.