暂存
This commit is contained in:
parent
fa2e4ed7af
commit
4a25e83d14
@ -59,7 +59,12 @@
|
||||
music: { name: 'music', list: [{ name: 'satori' }] },
|
||||
image: { name: 'image', list: [{ name: 'satori' }] }
|
||||
})
|
||||
const store = entanglement.get('json')
|
||||
const store = entanglement.get('json', event => {
|
||||
console.log(event)
|
||||
// 根据事件传递的路径, 更新对应的组件
|
||||
// 如何绑定多个组件而尽量降低代码量?
|
||||
// 传递变化
|
||||
})
|
||||
await new Promise(resolve => setTimeout(resolve, 3000))
|
||||
store.users.name = 'koishi'
|
||||
|
||||
@ -67,11 +72,12 @@
|
||||
element.innerHTML = store.users.list.map(user => `<li>${user.name}</li>`).join('')
|
||||
element.onclick = () => {
|
||||
store.users.list.push({ name: 'koishi' })
|
||||
// 在数据从其他位置被删除时也能删除这里的元素
|
||||
}
|
||||
document.body.appendChild(element)
|
||||
|
||||
|
||||
//users.list.push({ name: 'koishi' })
|
||||
// 主动查询获取数据, 然后将数据变化通过推送事件获取
|
||||
// 以事件绑定模式获取数据, 为元素绑定数据变化事件, 使数据变化时自动更新元素
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user