【发布时间】:2015-11-12 05:51:18
【问题描述】:
我第三天上课,我们应该做一个汽车瞄准器来使用物体。我有四个对象。我想为每个人制作一张桌子,左边是他们的钥匙,右边是他们的价值。四张桌子并排。我更愿意循环按键来制作和循环按键,因为我一直在玩并且失败得很惨。任何帮助将不胜感激。我有四个并排的 div,我想用表格填充它们。这是我的对象:
这是我的对象和价值观:
let Accord = new Car("Accord", 22500, "Crystal White", "alloy", "bose", "leather", "tinted");
let CRV= new Car("CR-V", 28400, "Midnight Black", "alloy", "stock", "cloth", "no tint");
let Pilot = new Car("Pilot", 36796, "Modern Gray Metallic", "alloy", "bose", "leather", "tinted");
let Fit = new Car("Fit", 17499, "Raspberry Blue", "steel", "stock", "cloth", "no tint");
//Here is the entire object:
class Car extends Vehicle {
wheels: string;
stereo: string;
seatsMaterial: string;
tint: string;
constructor(model, price, color, wheels, stereo, seatsMaterial, tint) {
super(model, price, color);
this.wheels = wheels;
this.stereo = stereo;
this.seatsMaterial = seatsMaterial;
this.tint = tint;
}
}
【问题讨论】:
-
你到底尝试了什么?
-
你试过这个答案了吗:stackoverflow.com/questions/921789/…
-
我尝试构建一个持有者并为每次迭代添加
+ key + 。我想我有点接近了,但我没有得到任何输出。 -
我看到了阿琼。谢谢。我只是不知道如何用它做一张桌子。
标签: javascript html typescript