核心代码:
const userInfo = {nickname: this.commentInfo.fromNickName, userId: this.commentInfo.fromUid};
let userInfoHtml = `<a href="toutou://user-detail?${stringify(userInfo)}" data-info="${stringify(userInfo)}" style="text-decoration:none;color:#3077EC">@${userInfo.nickname}: </a>`
const initHtml = this.commentInfo.content;
const reg = /(<p.*?>)(.*?<\/p>)/g;
userInfoHtml = initHtml.replace(reg, '$1'+'//' +userInfoHtml+'$2');
console.log('userInfoHtml',userInfoHtml)
this.editorCtx.setContents({html:userInfoHtml});
this.editorCtx.getContents({
complete(res) {
console.log('初始化转发的内容', res)
}
})