[英]jQuery-UI DatePicker not working with Aurelia and Typescript
我正在尝试围绕jQuery UI DatePicker创建包装器(自定义属性)。 date-picker.ts
如下所示:
import {inject, bindable} from "aurelia-framework";
export class DatePickerCustomAttribute {
static inject = [Element];
@bindable isdate;
constructor(public element:Element) {
}
bind() {
if (this.isdate) {
console.log("trying to set datepicker");
$(this.element).datepicker();
}
}
}
用法:
<require from="./date-picker"></require>
...
<input ... date-picker="isdate.bind:isDate"/>
这在Chrome中有效,但在Firefox或Edge中则无效。 代码在执行此行时引发错误: $(this.element).datepicker();
。 错误显示: Error: Assertion failed
。
我的开发设置:Visual Studio 2015-Aurelia-Typescript 1.5.4-以及必要的类型定义,例如aurelia ,jQuery, jQueryui和jQuery-ui-datetimepicker的类型定义。
寻求帮助和建议。
谢谢。
编辑:堆栈跟踪是这样的:
Stack trace:
assert@https://localhost:44300/Scripts/webcomponents.js:112:21
assertIsNodeWrapper@https://localhost:44300/Scripts/webcomponents.js:1573:7
.insertBefore@https://localhost:44300/Scripts/webcomponents.js:1787:9
.appendChild@https://localhost:44300/Scripts/webcomponents.js:1784:16
.buildFragment@https://localhost:44300/Scripts/jquery-2.1.4.js:5150:18
.domManip@https://localhost:44300/Scripts/jquery-2.1.4.js:5387:15
.append@https://localhost:44300/Scripts/jquery-2.1.4.js:5218:1
$.fn.datepicker@https://localhost:44300/Scripts/jquery-ui-1.11.4.js:5811:3
DatePickerCustomAttribute</DatePickerCustomAttribute.prototype.bind@https://localhost:44300/aureliaviews/shared/date-picker.js:19:17
.......
webcomponents.js(聚合物)引起了该问题。 尝试删除对该库的依赖。 更多疑难解答提示在这里:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.