Ionic 4 Click事件

时间:2019-01-28 08:46:15

标签: ionic-framework ionic4

嗨,我开始学习Ionic4。目前,packages.json中的版本是

      "@angular/animations": "~7.0.0",
      "@angular/common": "^7.2.2",
      "@angular/core": "^7.2.2",
      "@angular/platform-browser": "^7.2.2",
      "@angular/platform-browser-dynamic": "^7.2.2",
      "@angular/router": "^7.2.2",
      "@ionic-native/core": "^5.0.0",
      "@ionic-native/splash-screen": "^5.0.0",
      "@ionic-native/status-bar": "^5.0.0",
      "@ionic/angular": "^4.0.0"

并且正在尝试将按钮用作

<button ion-button (click)="test()">Click Me! </button>

问题在于click事件未绑定。我在这里想念什么?

1 个答案:

答案 0 :(得分:3)

Ionic 4不再使用<button>标签,而是使用<ion-button>

<!-- Default -->
<ion-button>Default</ion-button>

在这里看看:https://beta.ionicframework.com/docs/api/button