我收到错误:楼盘X上不存在类型Y []
questions does not exist on type 'Quiz[]'
这是我的模型
export interface Quiz {
$key ?: string;
categorie ?: string;
questions : Questions[]
}
export interface Questions {
id ?: number;
question ?: string;
answer?: string;
}
这是我的代码
import {Quiz} from "../models/quiz";
export class ProfComponent {
quiz = [] as Quiz[];
nextQuestion(quiz) {
this.quiz.questions.push(quiz.questions)
}
}
我不能将数据推入quiz.questions
什么可能是错的?
异步nextQuestion(测验){ 等待this.quiz.push(测验) } – Afnor