52 lines
1006 B
Vue

<template>
<view class="container">
<rich-text :nodes="tipsInfo.details"/>
</view>
</template>
<script>
import { request, picUrl, NavgateTo } from '../../utils';
import { apiArr } from '../../api/community';
export default {
data() {
return {
tipsInfo: {}
}
},
methods: {
decodeHTMLEntities(html) {
const entities = {
'&lt;': '<',
'&gt;': '>',
'&amp;': '&',
'&quot;': '"',
'&apos;': "'",
'&#39;': "'",
'&#x2F;': '/',
};
return html.replace(/&(lt|gt|amp|quot|apos|#39|#x2F);/g, (match) => entities[match] || match);
},
},
onLoad(options) {
let _this = this;
console.log('13212313', options);
uni.setNavigationBarTitle({
title: options.title,
})
request(apiArr.oneTips, 'POST', {
news_id: Number(options.id),
}).then((res) => {
const decodedString = _this.decodeHTMLEntities(res.details);
res.details = decodedString;
this.tipsInfo = res;
})
},
}
</script>
<style>
</style>