<div class="reading-page page">
<swiper class="swiper">
<swiper-item class="swiper-item" v-for="(swiperItem, index) in contentList"
@click="goVideo(swiperItem)" :key="index">
<div class="image-wrapper" :style="{backgroundImage: `url(${swiperItem.contentImg})`}">
<image mode="widthFix" :show-menu-by-longpress='true' class="image" :src="swiperItem.imgUrl"></image>
</div>
</swiper-item>
</swiper>
</div>
以上代码在加载完图片,滑动几下就会出现“小程序意外退出,请稍后重试”,直接奔溃了!有没有大神碰到的?
你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
找到问题了,最终发现图片大并且使用背景 style="{backgroundImage:`url(${swiperItem.contentImg})`}"去掉后一切正常了,具体原因还不是很清楚,盲猜是小程序可能对页面的渲染做了限制
image加一下lazy-load=true呢。
1.图片压缩,看看效果
2.图片在swiper里边,image标签还加 长按事件,这是为啥?
3.用原生小程序写一下看看效果。