export class Game {
contestantName: string;
tip: string;
rounds: Round[];
bg: any;
logo: any;
liveFeed: boolean;
fontsize:string;
fontsizeA:string;
answerMeter:boolean;
fontArray:string[]=[];
constructor() {
this.rounds = [new Round()];
this.fontArray.push("large");
this.fontsize="4.5vw";
this.fontsizeA="1.8vw";
}
}
我的主项目中有此文件,我通过导入 模块中的文件访问该类。我想通过使用索引来获取推送元素的值。
fontSizeHandler() {
for(i=0;i<this.game.rounds.length;i++) //value of this.game.rounds.length=1
{
console.log("loop");
console.log(this.game.fontArray[0]);
}
}
我在控制台中获得未定义的值我希望获得推送值而不会弹出。我尝试了很多,但徒劳地帮助我如何实现这一功能。