|
|
|
@ -20,7 +20,7 @@ |
|
|
|
:interval="interval" :duration="duration"> |
|
|
|
<swiper-item v-for="(item,index) in adList" :key="index" |
|
|
|
@tap="goAdPage(item)"> |
|
|
|
<img class="hero-bg-img" :src="item.pic" alt="" /> |
|
|
|
<img class="hero-bg-img" :src="item.adImage" alt="" /> |
|
|
|
</swiper-item> |
|
|
|
</swiper> |
|
|
|
<view class="hero-bg-mask"></view> |
|
|
|
@ -1123,17 +1123,12 @@ |
|
|
|
that.mallAds = res.result.mallAds |
|
|
|
for(let i=0;i<that.mallAds.length;i++){ |
|
|
|
if(that.mallAds[i].position == 'home_top'){ |
|
|
|
that.adList.push(that.mallAds[i]) |
|
|
|
// 判断字符串中是否包含逗号 |
|
|
|
if (that.mallAds[i].adImage.indexOf(',') !== -1) { |
|
|
|
// 有逗号:先按逗号分割,再过滤掉空字符串或纯空白字符串,最后映射为 {pic: url} 对象数组 |
|
|
|
that.adList = that.mallAds[i].adImage.split(',').filter(item => item.trim() !== '').map(url => ({ |
|
|
|
pic: url.trim() |
|
|
|
})); |
|
|
|
} else { |
|
|
|
// 没有逗号:整个字符串作为一个对象 |
|
|
|
that.adList = [{ |
|
|
|
pic: that.mallAds[i].adImage.trim() |
|
|
|
}]; |
|
|
|
if (that.mallAds[i].adImage.endsWith(',')) { |
|
|
|
that.mallAds[i].adImage = that.mallAds[i].adImage.slice(0, -1); |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
if (that.mallAds[i].adImage.endsWith(',')) { |
|
|
|
|