处理html换行问题
阅读原文时间:2023年07月13日阅读:1

String.prototype.replaceAll = function (FindText, RepText) {
regExp = new RegExp(FindText, "g");
return this.replace(regExp, RepText);
}

new Vue({
el: "#app",
data: {
sug: data.suggest.replaceAll('
','\n'),
assess: data.report.replaceAll('
','\n'),
isSubmit:data.isSubmit

},
mounted: function(){

},
methods: {
submitReport:function(){
$.ajax({//后台也校验是否表格全部完成 并且更新任务表完成量 /**/
type : 'put',
async :false,
url : "/spvs/mobile/scheduleAssess/submitReport?scheduleId="+scheduleId+"&report="+this.sug.replace(/\n/g,'
')+"&suggest="+this.assess.replace(/\n/g,'
')+"&access_token=" + localStorage.getItem("access_token"),
success: function(json){
if(json.code=="01"){
alert(json.message);
}
},
error: function(){
}
});
}

},
});