1.插入富文本
if(this.ArticleInfo&&this.ArticleInfo.Content){
document.getElementById('parent').insertAdjacentHTML("afterbegin", this.ArticleInfo.Content)
}
<div class="content_box" id="parent">
</div>
2.富文本的结构
//下面是文字获取属性数值
var labeList =document.querySelectorAll(".onRichtxt")
labeList.forEach((item,index)=>{
if(item){
item.addEventListener("click",(event)=>{
this.WakeApp(item.getAttribute("data-id"))
});
}
})
4.这个我不优化因为...这个我不优化因为...这个我不优化因为...这个我不优化因为...
WakeApp(type, target_id) {
// var fr = this.getUrlPara('fr');
const userAgent = navigator.userAgent
// document.getElementById('infoti').innerHTML += '-111:' + userAgent
if(userAgent.indexOf('YiQiZgjmFr')>-1){
var fr=userAgent.split('YiQiZgjmFr')[1].split('/')[1].split(' ')[0]
// ios_zgjm
}
let target = '';
if (fr == 'yiqi') {
target = 'yiqibaziapp://?type=app&target=' + type;
if (type == "LampDetail") {
target += '&target_id=' + target_id;
} else if (type == "Article") {
target += '&target_id=' + target_id;
}
} else if (fr == 'ios_zgjm') {
target = 'zybzApp://?type=app&target=' + type;
if (type == "LampDetail") {
target += '&target_id=' + target_id;
} else if (type == "Article") {
target += '&target_id=' + target_id;
} else if (type == "Link") {
target += '&target_id=' + target_id;
} else if (type == "FortuneBagDetail") {
target += '&target_id=' + target_id;
}else if (type == "car"||type == "Car") {
target += '&target_id=' + target_id;
}
} else if (fr == 'ios_cesuan') {
target = 'bzppApp://?type=app&target=' + type;
if (type == "LampDetail") {
target += '&target_id=' + target_id;
} else if (type == "Article") {
target += '&target_id=' + target_id;
} else if (type == "Link") {
target += '&target_id=' + target_id;
} else if (type == "FortuneBagDetail") {
target += '&target_id=' + target_id;
}
}
document.location = target;
},