Dart 使用Polymer将DateTime绑定到日期输入字段
最好的方法是什么 将输入元素的值绑定到DateTime实例时,将返回一个字符串: 是否有将输入绑定到DateTime实例的特定属性 或者我应该使用过滤器 [编辑] 以下是“我的工作过滤器”仅适用于日期输入类型: 输入元素不提供提供输入类型值的属性。您需要提供一个自定义处理程序来解析字符串值并更新元素的DateTime类型属性 e、 gDart 使用Polymer将DateTime绑定到日期输入字段,dart,dart-polymer,polymer,Dart,Dart Polymer,Polymer,最好的方法是什么 将输入元素的值绑定到DateTime实例时,将返回一个字符串: 是否有将输入绑定到DateTime实例的特定属性 或者我应该使用过滤器 [编辑] 以下是“我的工作过滤器”仅适用于日期输入类型: 输入元素不提供提供输入类型值的属性。您需要提供一个自定义处理程序来解析字符串值并更新元素的DateTime类型属性 e、 g 类似于此处所示的方法应该可以工作 <input type="date" value="{{dateString}}"> ... // inside
类似于此处所示的方法应该可以工作
<input type="date" value="{{dateString}}">
...
// inside the element's script...
date: null, // the DateTime typed attribute
// this handler automatically works
dateStringChanged: function(oldValue, newValue) {
this.date = DateTime.parse(newValue); // how about some error handling too?
},