Uncaught TypeError: Cannot read property 'reduce' of undefined
来源:4-7 话题详情页

慕侠3851047
2018-07-16
@computed get detailMap() { // 方便获取某个 id 下的 detail return this.details.reduce((result, detail) => { console.log("getTopic deail.id: ", detail.id) // eslint-disable-line result[detail.id] = detail // eslint-disable-line console.log("getTopic result: ", result) // eslint-disable-line return result }, {}) }
查看到的 result 是这个对象
错误
Uncaught TypeError: Cannot read property 'reduce' of undefined at Object.get (topic-store.js?a13d:52) at ComputedValue$$1.computeValue (mobx.module.js?daf9:875) at ComputedValue$$1.get (mobx.module.js?daf9:805) at ObservableObjectAdministration$$1.read (mobx.module.js?daf9:3413) at Object.get (mobx.module.js?daf9:3673) at backend.js:7516 at Array.forEach (<anonymous>) at Bridge._inspectResponse (backend.js:7512) at Bridge._handleMessage (backend.js:7393) at listener (backend.js:86)
details 内容
写回答
1回答
-
报错是reduce方法,你的detials是什么内容?
032018-07-17
相似问题