【发布时间】:2015-06-19 07:30:00
【问题描述】:
我正在尝试根据CustomAttribute 约定在 Aurelia 中构建自定义属性。但是,当我尝试在视图中使用它时,使用<import from='./shared/tr'></import>,aurelia 会尝试在同一路径中查找tr.html。
正是我在这里缺少的东西?
编辑:
tr.js 如下所示:
import aur = require("aurelia-framework");
export class TrCustomAttribute {
public element;
static inject = [Element];
constructor(element) {
this.element = element;
}
bind() {
console.log(this.element);
}
valueChanged(newValue) {
if (newValue) {
console.log(newValue);
}
console.log(this.element);
}
}
我正在尝试使用如下属性:
<import from='./shared/tr'></import>
<button class="btn btn-primary" tr="something"> Something </button>
【问题讨论】: