index.js
734 Bytes
import WxParse from '../../vendors/wxParse/wxParse';
Component({
properties: {
content: {
type: String,
value: '',
observer: '_htmlFormat'
},
disableImagePreview: {
type: Boolean,
value: false
}
},
data: {
detail: {}
},
methods: {
_htmlFormat: function() {
let html = (this.data.content || '').replace(/alt="\\"/g, 'alt=""'); // 异常字符处理
WxParse.wxParse('detail', 'html', html, this, 5);
if (this.data.disableImagePreview) {
this.wxParseImgTap = () => {
return false;
};
}
}
}
});