Joe*_*e25 0 javascript frontend ember.js
我目前面临计算属性的问题,我有一个名为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 call a class as a function
at classCallCheck (ember-babel.js:11)
at Object.Class [as Object] (core_object.js:25)
at Module.callback (crossconnection.js:65)
at Module.exports (loader.js:106)
at requireModule (loader.js:27)
at Class._extractDefaultExport (index.js:410)
at Class.resolveOther (index.js:110)
at Class.superWrapper [as resolveOther] (ember-utils.js:420)
at Class.resolve (resolver.js:133)
at _resolve (container.js:871)
classCallCheck @ ember-babel.js:11
Class @ core_object.js:25
(anonymous) @ crossconnection.js:65
Module.exports @ loader.js:106
requireModule @ loader.js:27
_extractDefaultExport @ index.js:410
resolveOther @ index.js:110
superWrapper @ ember-utils.js:420
resolve @ resolver.js:133
_resolve @ container.js:871
resolve @ container.js:574
resolve @ container.js:578
factoryFor @ container.js:136
factoryFor @ container_proxy.js:40
modelFactoryFor @ -private.js:11593
_modelFactoryFor @ -private.js:11556
_modelFor @ -private.js:11547
modelFor @ -private.js:11540
_query @ -private.js:8666
_query @ -private.js:10819
query @ -private.js:10806
(anonymous) @ ops.js:55
applyStr @ ember-utils.js:524
sendEvent @ ember-metal.js:257
notifyObservers @ ember-metal.js:1103
propertyDidChange @ ember-metal.js:886
set @ ember-metal.js:2893
set @ observable.js:104
openOpPopupWithKey @ ops.js:143
send @ action_handler.js:28
(anonymous) @ action.js:124
exports.flaggedInstrument @ ember-metal.js:3920
(anonymous) @ action.js:123
_run @ backburner.js:758
_join @ backburner.js:736
join @ backburner.js:477
run.join @ ember-metal.js:4366
handler @ action.js:102
(anonymous) @ event_dispatcher.js:234
dispatch @ jquery.js:5183
elemData.handle @ jquery.js:4991
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
840 次 |
| 最近记录: |