我下载的本教程有问题。在this.games [{会产生错误。错误提示:
输入'[{game:string;平台:字符串;发布:字符串; }, { 游戏: 串;平台:字符串;版本:...”不可分配给类型“ [{ 游戏:字符串;平台:字符串;发布:字符串; }]'。种类 属性“长度”不兼容。类型“ 6”不可分配给 输入“ 1”。
错误是什么意思?我该如何解决? 本教程在某些上下文中用于突出显示表的选定单元格。
import {Component} from '@angular/core';
@Component({
selector: 'app-home',
templateUrl: './app/home/home.component.html'
})
export class HomeComponent {
headMessage : string;
selectedRow : Number;
setClickedRow : Function;
games : [{
game: string,
platform : string,
release : string
}];
constructor(){
this.headMessage = "Please click below rows !!";
this.games =[{
game : "Deus Ex: Mankind Divided",
platform: " Xbox One, PS4, PC",
release : "August 23"
},
{
game : "Amplitude",
platform: " PS4",
release : "January 5"
},
{
game : "The Huntsman: Winter's Curse",
platform: "PS4",
release : "August 23"
},
{
game : "Resident Evil Zero HD Remaster",
platform: "Win, PS3, PS4, X360, XBO",
release : "January 19"
},
{
game : "Lego Marvel's Avengers",
platform: "Win, X360, XBO, PS3, PS4, PSVita, WiiU, 3DS",
release : "January 26"
};
this.setClickedRow = function(index){
this.selectedRow = index;
}]
};
};