Commit 99d631ee authored by Chen Jiping's avatar Chen Jiping

fix:增加默认值

parent 86c4d69b
......@@ -16,6 +16,7 @@ import TWEEN from '@tweenjs/tween.js';
import { Button } from './Button';
import { AudioAnimation } from './AudioAnimation';
import { Card } from './Card';
import { getDefaultAnswer } from '../bean/ExercisesBean';
......@@ -454,8 +455,21 @@ export class PlayComponent implements OnInit, OnDestroy {
* 添加默认数据 便于无数据时的展示
*/
initDefaultData() {
if(!this.data.rightAnswer){
this.data.rightAnswer = getDefaultAnswer();
this.data.rightAnswer.isRight = '1';
this.data.rightAnswer.val = 'Hello';
}
if(!this.data.answerArr){
this.data.answerArr = [];
for(let i = 0; i < 3; ++ i){
let answer = getDefaultAnswer();
answer.val = "" + i;
this.data.answerArr.push(answer);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment