-
Notifications
You must be signed in to change notification settings - Fork 1
/
Untitled-2.html
44 lines (34 loc) · 1.08 KB
/
Untitled-2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<html>
<head></head>
<body>
</body>
</html>
<script>
// setPass(state, pass) {
// if (pass.RoomName && state.queues[pass.RoomName] && state.queues[pass.RoomName].pass instanceof Array) {
// state.queues[pass.RoomName].pass.push(pass)
// }
// }
const state = {
queues: [
{
RoomName: '123',
pass: [{
item: 1001
}]
}
]
}
// const temp1 = {}
// temp1=state.queues.find(s => s.RoomName == '123')
let temp1 = {}
Object.assign(temp1,state.queues.find(s => s.RoomName == '123'))
console.log(temp1.prototype === state.prototype)
temp1=JSON.parse(JSON.stringify(state.queues.find(s => s.RoomName == '123')))
console.log(temp1.prototype === state.prototype)
const temp2 = state.queues.filter(s => s.RoomName == '123')
console.log(temp2.prototype === state.prototype)
console.log('state开始:', JSON.stringify(state))
temp1.RoomName = '456'
console.log('state结束:', JSON.stringify(state))
</script>