ModalController 消除函数调用离子或角度中的其他组件

发布于 2025-01-12 02:54:08 字数 918 浏览 4 评论 0原文

**other component html file where want call dismiss function**                            
<ion-col size="2" class="btn-center">
    <ion-buttons class="btn-close">
      <ion-button (click)="onCloseComponent()">
        <ion-img src="/assets/img/closebtn.svg"></ion-img>
      </ion-button>
    </ion-buttons>
  </ion-col>

组件ts是父组件

  async presentTextModal() {
this.blocksToolsTextComponentModal = await this.modalController.create({
  component: BlocksToolsTextComponent,
  cssClass: 'blocks-tools-text',
  swipeToClose: true,
  initialBreakpoint: 0.3,

  breakpoints: [0, 0.3],
});
return await this.blocksToolsTextComponentModal.present();

}

大家好,我想通过点击另一个组件来调用另一个组件的dismiss函数。调用模态的函数位于一个组件中。我什至需要在调用的模式中有一个单击按钮来关闭模式。也就是说,在打开的组件中我调用dismiss函数。我在框架中使用 modalController ionic。谢谢你的建议

**other component html file where want call dismiss function**                            
<ion-col size="2" class="btn-center">
    <ion-buttons class="btn-close">
      <ion-button (click)="onCloseComponent()">
        <ion-img src="/assets/img/closebtn.svg"></ion-img>
      </ion-button>
    </ion-buttons>
  </ion-col>

component ts which is parent

  async presentTextModal() {
this.blocksToolsTextComponentModal = await this.modalController.create({
  component: BlocksToolsTextComponent,
  cssClass: 'blocks-tools-text',
  swipeToClose: true,
  initialBreakpoint: 0.3,

  breakpoints: [0, 0.3],
});
return await this.blocksToolsTextComponentModal.present();

}

Hello everyone, I want to call the dismiss function from another component by clicking on another component. A function that calls a modal is in one component. I even need to have a click button in the summoned modal that closes the modal. That is, in the opened component I call the dismiss function. I am using modalController ionic in the framework. thank you for advice

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文