我总是收到这样的错误:
未捕获(承诺中)TypeError:无法读取未定义的属性“periodListSchema”
这是我的代码:
我的架构
import { schema, arrayOf } from 'normalizr';
export const periodSchema = new schema.Entity('activePeriod');
export const periodListSchema = new schema.Array(periodSchema);
我的规范化操作
then(response => {
console.log('normalized response', normalize(response.schema.periodListSchema));
这是我的回应
{"activePeriod":[{"periodID":2,"periodName":"Periode 27","startDate":"2016-11-11","endDate":"2016-12-11","remark":"Periode Alpha 27","isActive":"1"}],"status":"OK"}
我的 Normalzr 库是 v3.2.2 有人可以帮我找出问题所在吗?我正在努力理解这一点。