如何在 Aurelia 中将 computedFrom 与多个属性一起使用

How to use computedFrom with multiple properties in Aurelia

提问人:Clare Barrington 提问时间:6/17/2016 最后编辑:Matthew James DavisClare Barrington 更新时间:6/18/2016 访问量:895

问:

我有以下代码:

@computedFrom(['id', 'isDiscontinued'])
get disableAdd(){
    return this.id === '0' || this.isDiscontinued;
}

这将引发以下错误:aurelia-binding.js:2580 Uncaught TypeError: this.input.charCodeAt is not a function

但是,这有效:

@computedFrom('id')
get disableAdd(){
    return this.id === '0' || this.isDiscontinued;
}

但是我需要两个 computedFrom 字段,我做错了什么?

奥蕾莉亚

评论


答:

6赞 Clare Barrington 6/17/2016 #1
@computedFrom('id', 'isDiscontinued')
get disableAdd(){
    return this.id === '0' || this.isDiscontinued;
}

不需要[]