Skip to content

Commit

Permalink
修复swiper组件内未包含子组件时导致异常的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zhetengbiji committed Nov 23, 2018
1 parent eb0b9ad commit 558079b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
.project
unpackage/
unpackage/
.vscode/
32 changes: 17 additions & 15 deletions src/core/view/components/swiper/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -552,21 +552,23 @@ export default {
var slidesDots = []
var index = 0
var swiperItems = []
this.$slots.default.forEach(vnode => {
if (vnode.componentOptions && vnode.componentOptions.tag === 'v-uni-swiper-item') {
swiperItems.push(vnode)
slidesDots.push(createElement('div', {
class: {
'uni-swiper-dot': true,
'uni-swiper-dot-active': index === this.currentSync
},
style: {
'background': index === this.currentSync ? this.indicatorActiveColor : this.indicatorColor
}
}))
index++
}
})
if (this.$slots.default) {
this.$slots.default.forEach(vnode => {
if (vnode.componentOptions && vnode.componentOptions.tag === 'v-uni-swiper-item') {
swiperItems.push(vnode)
slidesDots.push(createElement('div', {
class: {
'uni-swiper-dot': true,
'uni-swiper-dot-active': index === this.currentSync
},
style: {
'background': index === this.currentSync ? this.indicatorActiveColor : this.indicatorColor
}
}))
index++
}
})
}
this.items = swiperItems
var slidesWrapperChild = [createElement('div', {
ref: 'slides',
Expand Down

0 comments on commit 558079b

Please sign in to comment.