我想通过数组中的值更改模态分量参数。但是我不知道该怎么做。传递数组时,它需要编写代码,而不是数组值。
componentArray: any[] = [{component: 'modal1Page'}, {component: 'modal2Page'}];
async onClick(value: any) {
const myModal = await this.modalController.create({
component: this.componentArray[0],
cssClass: 'modalCss',
componentProps: {
value: value,
}
});
return await myModal.present();
}
它是这样解释的:“ component:this .componentArray [0]; ”,我希望它这样解释:“ < em> component:modal1Page; “
感谢您的帮助
答案 0 :(得分:1)
我认为您刚刚错过了.component
async onClick(value: any) {
const myModal = await this.modalController.create({
component: this.componentArray[0].component,
cssClass: 'modalCss',
componentProps: {
value: value,
}
});
return await myModal.present();
}