最近在做项目的过程中,需要在地图添加轮播图
setActiveItem: function (e,page) {
if ('string' == typeof e) {
var t = this.items.filter(function (t) {
return t.name === e
})
t.length > 0 && (e = this.items.indexOf(t[0]))
}
if (((e = Number(e)), isNaN(e) || e !== Math.floor(e)))
console.warn(
'[Element Warn][Carousel]index must be an integer.'
)
else {
if(page == 'owner') {
var i = this.items.length,
n = this.activeIndex;
this.activeIndex = e
n === this.activeIndex && this.resetItemPosition(n),
this.resetTimer()
} else {
var i = this.items.length,
n = this.activeIndex
;(this.activeIndex =
e < 0
? this.loop
? i - 1
: 0
: e >= i
? this.loop
? 0
: i - 1
: e),
n === this.activeIndex && this.resetItemPosition(n),
this.resetTimer()
}
}
},
this.$refs.carousel.setActiveItem(i, 'owner')