不允许修改查询完的数据
来源:3-8 介绍登录-使用session

听蓝茶生活
2020-01-13
const { count, rows } = result
const blogList = []
if (count) {
rows.map((item) => {
const { content = '', ...obj } = item.dataValues
content = content.length > 40 ? content.substring(0, 40) + '...' : content
blogList.push({
content,
...obj,
user: formatUser(item.user.dataValues)
})
})
}
写回答
1回答
-
双越
2020-01-13
要去扩展新的属性,不要修改原数据 —— 这种编程思路没有副作用。
00
相似问题