I'm new to Aurelia, and trying use inheritance with custom elements:
base.js
import {bindable, inject} from 'aurelia-framework';
@inject(Element)
export class BaseCustomElement {
list = [1]
constructor() {
console.log(this.list)
}
}
control1.js
import {bindable, inject} from 'aurelia-framework';
import {BaseCustomElement} from 'base';
@inject(Element)
export class Control1CustomElement extends BaseCustomElement{
list = [1,3]
constructor() {
super()
}
}
Where am I wrong?
使用extends
不extend
在这里:
export class Control1CustomElement extend BaseCustomElement{
Without more detail it is impossible to know what the problem is but I'm guessing it has something to do with the contents of list - but, anyway, as a first guess how about
No idea if this will solve the 'unexpected behaviour' though as we don't know what you're expecting...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.