ion-button单击“不激活" ionic 4中的功能 [英] ion-button Click not firing up function in ionic 4

查看:96
本文介绍了ion-button单击“不激活" ionic 4中的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的ionic 4代码中有一个按钮和一个功能.理想情况下,只要单击按钮,该功能就会启动,但那没有发生.

I have a button and a function in my ionic 4 Code. Ideally on the click of the button, the function should fire up but that's not happening.

我的HTML

<ion-content padding>
<div class="contentFlow" id="profile-content">
    <h1>Profile</h1>
    <ion-button (click)="clicked()"  expand="block" color="light">
      Logout
    </ion-button>
  </div>
</ion-content>

我的TS:

clicked() {
    alert('hello');
  }

注意:我需要将div保留在我的代码中.

Note: I need to keep the div in my code.

我该怎么办?

推荐答案

当元素的呈现重叠时,我已经看到了这种情况.

I have seen such things when the rendering of elements is overlapping.

您应该检查.在整个元素的顶部可能有一个不可见的层.因此,您可以看到它,但不能与它进行交互.让我们感到简单的按钮操作不起作用.

You should check. There maybe an invisible layer on top of the whole element. So you can see it but you cannot interact with it. Making us feel that the simple button press is not working.

欢呼

这篇关于ion-button单击“不激活" ionic 4中的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆