有沒有辦法可以傳遞這個 itemId 引數,以便 MarketPlaceItemPage 可以使用該資料?
async presentMarketplaceItem(itemId: number) {
const modal = await this.modalController.create({
component: MarketplaceItemPage,
cssClass: '',
mode: 'ios',
});
return await modal.present();
}
我只是沒有在 Ionic 檔案中找到我需要的東西。提前致謝!
uj5u.com熱心網友回復:
這是 Ionic 的官方檔案
您正在尋找的屬性是componentProps。Ionic 控制器未在其 v5 檔案中列出,但在 v4 下列出。
另一種方式(更快的 IMO)是直接瀏覽源代碼(ctrl click),它會顯示控制器方法簽名。
uj5u.com熱心網友回復:
我從這個網站上找到了一些有用的東西https://www.freakyjolly.com/ionic-modal-popovers-pass-receive-data/
async presentMarketplaceItem(itemId: number) {
const modal = await this.modalController.create({
component: MarketplaceItemPage,
componentProps:{
id: itemId
},
cssClass: '',
mode: 'ios',
});
return await modal.present();
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/371419.html
上一篇:在物件內的陣列屬性中找到一個詞
