<template>

<rich-text :nodes="content" style="width: 100%;word-wrap: break-word;"></rich-text>

</template>

<script>
import {
queryProductDetail
} from "@/api/api.js" // 后端接口
export default {
data() {
return {
content: '', // 富文本内容
};
},
onLoad(option) {

},
onShow() {
this.getProductDetail()
},
mounted() {
},
methods: {

// 获取商品详情
getProductDetail() {
queryProductDetail(this.productId).then(res => {
if (res.code == 200) {
let content = res.data.detail.replace(/\<img/g, "<img style='width: 100%;'") // 设置富文本所有图片宽度
this.content = content
}

})
},
}
}
</script>

posted on 2023-04-11 13:41  &蝶儿&  阅读(725)  评论(0编辑  收藏  举报