我注意到我在本地服务器上收到了我的本地人的副本。例如
Object {
settings: "4.2",
env: "development",
utils: true,
pretty: true,
_locals: {
settings: "4.2",
env: "development",
utils: true,
pretty: true,
posts: {
0 { title: 'post 1' },
1 { title: 'post 2' }
}
},
posts: {
0 { title: 'post 1' },
1 { title: 'post 2' }
}我不相信我把这个放哪儿了。为什么会是这样,我应该删除它,以及什么是最好的方式。
我使用keystone JS,Express和Node。
这个问题的标题是相似的,但问题本身却不同。locals and locals in express 4.0
发布于 2016-07-02 09:51:41
JS没有任何机会隐藏对象的私有成员。因此,常见的做法是通过_启动它们。
这意味着使用由_启动的成员(例如obj._locals )是不正确的。
https://stackoverflow.com/questions/38154983
复制相似问题