【发布时间】:2017-05-18 10:52:09
【问题描述】:
我是 Aurelia 的初学者。我想编写一个自定义属性,如下所示:
square.js:
/*jshint esversion: 6 */
import {bindable, inject} from 'aurelia-framework';
@inject(Element)
export class SquareCustomAttribute {
@bindable sideLength;
@bindable color;
constructor(element){
this.element = element;
}
sideLengthChanged(newValue, oldValue){
this.element.style.width = this.element.style.height = `${newValue}px`;
}
colorChanged(newValue, oldValue){
this.element.style.backgroundColor = newValue;
}
}
你可以在下面看到html:
<template>
<require from="./square"></require>
<div square="color.bind: squareColor; side-length.bind: squareSize"></div>
</template>
我得到一个错误:
ERROR [app-router] 错误:(SystemJS) 无法动态转译 ES 模块,因为 SystemJS.transpiler 设置为 false。
你能帮帮我吗?
【问题讨论】:
-
这与您的
SquareCustomAttribute类和您的 SystemJS 转译器有冲突。这门课的写法和你其他的一样吗? -
我尝试了不同的课程。我总是收到这个错误
-
您是否更改了构建或任务文件夹中的某些内容?
-
我找到了。问题好复杂……我把js改成ts了。
-
@user2505235 - 当我询问这是否与您的其他课程以相同的方式编写时,这就是我的意思。很高兴你把它整理好了。