安卓使用webp, ios使用jpg

This commit is contained in:
jqtmviyu@gmail.com 2021-02-27 17:39:16 +08:00
parent 2ba43a28d2
commit 3c2262a444

View File

@ -54,7 +54,16 @@ export default {
this.goods_name = goods_name this.goods_name = goods_name
this.goods_price = goods_price this.goods_price = goods_price
// img // img
this.goods_introduce = goods_introduce.replace(/<img/g, '<img class="img"') let htmlStr = goods_introduce.replace(/<img/g, '<img class="img"')
//
const res = uni.getSystemInfoSync()
if (res.system.startsWith("iOS")) {
// ios .webp
const iosStr = htmlStr.replace(/\.webp/g, ".jpg")
this.goods_introduce = iosStr
} else {
this.goods_introduce = htmlStr
}
}, },
showBigImgHandle(current){ showBigImgHandle(current){
const urls = this.pics.map(item => item.pics_big) const urls = this.pics.map(item => item.pics_big)