locals AND locals._locals(克隆)从服务器发送
locals AND locals._locals (clone) sent from server
我注意到我在我的本地人中从服务器收到了我的本地人的副本。例如
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。
这个问题的标题相似,但问题本身不同。
Difference between _locals and locals in express 4.0
JS 没有任何机会隐藏对象的私有成员。所以通常的做法是从 _.
开始
这意味着使用以 _ 开头的成员,例如 obj._locals,是不正确的。
我注意到我在我的本地人中从服务器收到了我的本地人的副本。例如
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。
这个问题的标题相似,但问题本身不同。 Difference between _locals and locals in express 4.0
JS 没有任何机会隐藏对象的私有成员。所以通常的做法是从 _.
开始这意味着使用以 _ 开头的成员,例如 obj._locals,是不正确的。