安卓使用webp, ios使用jpg
This commit is contained in:
parent
2ba43a28d2
commit
3c2262a444
@ -54,7 +54,16 @@ export default {
|
||||
this.goods_name = goods_name
|
||||
this.goods_price = goods_price
|
||||
// 给富文本中的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){
|
||||
const urls = this.pics.map(item => item.pics_big)
|
||||
|
Loading…
Reference in New Issue
Block a user