因为我要做的界面和组长的界面差不多所以我直接拷贝的代码,本来是好好的、安安静静地在那里展示着,但是不知道怎么回事,全乱了,所以调样式吧,后台传给我的是一张试卷的json?,接到之后转格式
改之后的代码,这样展示的是一行,将 什么的都去掉了:
ngOnInit() {
if (this.question.stuScore == "" || this.question.stuScore == null) {
this.question.stuScore = "0"
}
if (this.question.studentAnswer.includes("<br>")) {
this.changeWordForShow(this.question.studentAnswer);
}
}
changeWordForShow(studentAnswerData: string) {
let arg: string[] = this.question.studentAnswer.split("<br>");
let textForAnswer: string = "";
for (var i = 0; i < arg.length; i++) {
textForAnswer = textForAnswer + arg[i].toString();
}
this.question.studentAnswer=textForAnswer;
let lastThingForAnswer: string = '';
if (textForAnswer.includes(" ")) {
let dataMerge:any = this.question.studentAnswer.split(" ");
dataMerge.forEach(eleInd