当我从父对象传递对象到子组件时 - 它转换为字符串
<m-tank-add fuelTypes="{{this.fuelTypes}}" count="{{count}}"></m-tank-add>
@Input() fuelTypes: Array<FuelTypeModel>;
@Input() count: number;
count
来自"5"
和fuelTypes
作为"[object Object],[object Object],[object Object],[object Object],[object Object]"
如何传递参数以便它们不会转换为字符串?
您应该通过方括号使用属性绑定,因为插值是字符串化的:
[fuelTypes]="fuelTypes"
也可以看看: