事件绑定语法(可以通过 (事件名)
的语法,实现事件绑定)
<date-picker (dateChanged)="statement()"></date-picker> 等价于: <date-picker on-dateChanged="statement()"></date-picker>
@Component({ selector: ‘sl-user‘, template: ` <button (click)="toggleSkills()"> {{ showSkills ? "隐藏技能" : "显示技能" }} </button> ` }) export class UserComponent { toggleSkills() { this.showSkills = !this.showSkills; } }
时间: 2024-11-07 17:12:57