diff --git a/.gitignore b/.gitignore index 9594b8fb5790d547682b954f74048ba84247f2f2..642f27072a56ce1f5c660e7241f690ddc7775377 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules/ .project -unpackage/ \ No newline at end of file +unpackage/ +.vscode/ \ No newline at end of file diff --git a/src/core/view/components/swiper/index.vue b/src/core/view/components/swiper/index.vue index d5b4a354e82345ab8a82673ad7da1ef6f13763a4..0d252dddc36aa680df1d21da83abf217e9beb42f 100644 --- a/src/core/view/components/swiper/index.vue +++ b/src/core/view/components/swiper/index.vue @@ -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',