Gist that can be pasted into http://requirebin.com that shows the issue in consolevar normalizr = require("normalizr")const photos = new normalizr.schema.Entity('photos')const phones = new normalizr.schema.Entity('phones')const user = new normalizr.schema.Entity('user', { photos: [photos], phones: [phones]})const usersSchema = new normalizr.schema.Array(user)var users = [ {id: 1, name: "bob", phones: [{id:3, phone: 45234324},{id:4, phone: 42342432}]}, {id: 2, name: "will", phones: [{id:3, phone: 45234324},{id:6, phone: 5435345}]}, {id: 4, name: "sam", phones: [{id:6, phone: 5345353},{id:7, phone: 42342432}]}]var normalizedUsers = normalizr.normalize(users, usersSchema)var denormalizedUser = normalizr.denormalize([2], user, normalizedUsers)console.log(denormalizedUser)推荐答案此行是错误的:var denormalizedUser = normalizr.denormalize([2], user, normalizedUsers)第一个参数应为2或第二个参数应为[ user ].Either your first argument should just be 2 or your second argument should be [ user ].此外,normalizedUsers应该只是entities,而不是完整的标准化结果.使用normalizedUsers.entitiesAlso, normalizedUsers should be just the entities, not the full normalized result. Use normalizedUsers.entities 这篇关于无法使用新的Normalizr 3.1.0对实体进行非规范化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-11 07:51