import {getDataSet, getEventParam} from "../../utils/utils"; Component({ externalClasses: ['banner-container', 'banner-img'], properties: { // imgList 必须存在url 显示图片 imgList: Array, imgWidth: String, imgHeight: String, imgRadius: String }, data: { current:0, currentIndex: 0, autoplay:true }, methods: { swiperChange(e) { this.setData({ currentIndex: getEventParam(e, 'current') }) }, onTap(e) { const index = getDataSet(e, "index"); const imgList = this.data.imgList this.triggerEvent('banner', { item: imgList[index] }) }, }, })