typescript - 为什么需要添加文本更改事件以及我们如何在 Aurelia 应用程序中添加
问题描述
这样我们可以添加文本更改事件吗?分享一些有用的链接,我可以在其中学习 Aurelia 应用程序
文本框.ts
export class Textbox {
@bindable textValue='';
@bindable displayName: string;
constructor(controllerFactory) {
this.controller = controllerFactory.createForCurrentScope();
this.controller.validateTrigger = validateTrigger.changeOrBlur;
this.controller.addRenderer(new BootstrapFormRenderer());
}
attached() : void {
this.controller.validate();
}
}
ValidationRules
.ensure((c:Textbox) => c.textValue)
.required().withMessage("This field is required!")
.maxLength(50)
.on(Textbox);
文本框.html
<input type="text" placeholder.bind="placeholder" onchange="alert('textvalue changed')" class="form-control" value.bind="textValue & validate">
应用程序.html
<template>
<textbox></textbox>
</template>
解决方案
推荐阅读
- javascript - 如何动画导航栏返回网站顶部?
- php - 如何从 Wordpress 上 Gutenberg 的 YouTube 视频嵌入中删除 HTML 包装器
- rust - 如何“连接”一个 UDP 套接字并让操作系统选择端口和地址
- spring-boot - Spring Boot JPA 插入和更新
- delphi - 如何知道当前证书的密码是否有效
- node.js - 如何存储 Spotify api 的访问令牌。我正在使用passport.js
- neo4j - Neo4j (4.1.3) :当匹配为一个标签返回一行时如何动态创建关系
- r - R 将在 Mac 上生成一个字符串数组,但在 Windows 上是一个因素
- c# - 游戏对象上的统一位置图像无法正常工作*已修复*
- eclipse - 在 Eclipse Windows Builder 设计视图中不显示任何内容