【发布时间】:2016-02-18 19:27:55
【问题描述】:
我在将属性传递到自定义组件时遇到了一些问题。我尝试通过以下方式声明我的组件:
<require from="../components/project-documents"></require>
<project-documents projectId="testing123"></project-documents>
<project-documents projectId.bind="project.Name"></project-documents>
import {customElement, bindable} from "aurelia-framework";
import {autoinject} from "aurelia-dependency-injection";
@customElement("project-documents")
export class ProjectDocuments {
@bindable projectId:string;
attached() {
alert(this.projectId);
}
}
当调用警报时, undefined 是我从中得到的值。另外,是否需要 customElement 装饰器?
【问题讨论】:
标签: aurelia