我目前面临计算属性的问题,我有一个名为crossconnection的模型,包含一些计算属性,如:
relevantPoints: computed(function () {
if (this.get('IsCA') === true && this.get('IsCM') === true) {
return "/assets/images/big/ca-cm.png";
}
else if (this.get('IsCA') === true && this.get('IsCM') === false) {
return "/assets/images/big/ca.png";
}
else if (this.get('IsCA') === false && this.get('IsCM') === true) {
return "/assets/images/big/cm.png";
}
else if (this.get('IsCA') === false && this.get('IsCM') === false) {
return "/assets/images/big/nca-ncm.png";
}
}),
Run Code Online (Sandbox Code Playgroud)
在运行项目时,我不断收到以下错误:
未捕获的TypeError:无法将类作为函数调用
有人可以澄清一下吗?
PS:我在用,
更新:
澄清:我有一个包含一些计算属性的模型'crossconnection',我的模型是通过一个简单的控制器调用的
from = this.store.query('crossconnection ', {
fromOpKey: this.get('opSelected').get('opKey'),
limit: -1
});
Run Code Online (Sandbox Code Playgroud)
然后导致以下错误(附加完整堆栈跟踪)
Uncaught TypeError: Cannot …Run Code Online (Sandbox Code Playgroud)