如题,ng-alain模板中,使用delon类库创建一个curd组件,curd组件中,点击编辑按钮向编辑子组件传值失败,请问,这个参数应怎么穿过去?
主组件代码片段:
columns: STColumn[] = [
{ title: '编号', index: 'no' },
{ title: '调用次数', type: 'number', index: 'callNo' },
{ title: '头像', type: 'img', width: '50px', index: 'avatar' },
{ title: '时间', type: 'date', index: 'updatedAt' },
{
title: '',
buttons: [
{
text: '编辑',
type: 'modal',
modal: {
component: TestCurdEditComponent,
params: (record: any) => (record = record),
},
},
],
},
];
子组件代码片段:
@Input()
record: any = {};
i: any;
constructor(
private modal: NzModalRef,
private msgSrv: NzMessageService,
public http: _HttpClient,
) {}
ngOnInit(): void {
console.log(this.record);//this.record的值为空
if (this.record.id > 0)
this.http.get(/user/${this.record.id}
).subscribe(res => (this.i = res));
}
学习angular的新手,请帮忙看看子组件怎么才可以获取到record的值,谢谢。