zycp-ddxcx/components/swiper-map/swiper-map.js

67 lines
1.2 KiB
JavaScript

Component({
mixins: [],
data: {
indicatorDots: true,
autoplay: true,
vertical: false,
interval: 4000,
circular: true,
bannerList:[]
},
// 轮播事件start
changeIndicatorDots(e) {
this.setData({
indicatorDots: !this.data.indicatorDots,
});
},
changeVertical() {
this.setData({
vertical: !this.data.vertical,
});
},
changeCircular(e) {
this.setData({
circular: !this.data.circular,
});
},
changeAutoplay(e) {
this.setData({
autoplay: !this.data.autoplay,
});
},
intervalChange(e) {
this.setData({
interval: e.detail.value,
});
},
// 轮播事件end
props: {},
didMount() {
this.bannerEv();
},
didUpdate() {},
didUnmount() {},
methods: {
// 获取轮播图
bannerEv(){
dd.$http.get('/api/dictionary/get-slide-list',{position:'customer_home_banner'}).then(res=>{
if(res.code==0){
let arr = [];
res.data.forEach(item=>{
let bannerObj = {
id:item.id,
src:dd.baseUrl + item.src,
url:item.url
}
arr.push(bannerObj);
})
this.setData({
bannerList:arr
})
}
})
},
},
});