// Although the object can be locally unfrozen, it seems there's no way to replace the single frozen item in Vue's data. It may be possible to clone, unfreeze, update, and replace the entire dict but that's not a good solution
// See here for working unfreeze and how to override the Object.freeze method: https://stackoverflow.com/questions/19293321/opposite-of-object-freeze-or-object-seal-in-javascript/26752410#26752410
console.clear();
Vue.component('recycle-scroller', VueVirtualScroller.RecycleScroller)
Vue.component('my-list', {
props: ['list'],
template: `
<recycle-scroller
class="scroller"
:items="list"
:item-height="32"
keyField="id"
>
<div slot-scope="{item}" class="user">
{{ item }}
</div>
</recycle-scroller>
`
})
new Vue({
el: "#app",
async created() {
let id = '0'
//let item = Object.freeze({
let item = {
id,
text: 'hi ' + id
}
//)
this.$set(this.dict, id, item)
await timeout()
//let yoyo = Object.unfreeze(this.dict[id])
let yoyo = this.dict[id]
yoyo.text = 'UPDATED'
this.dict[id] = yoyo
//this.$set(this.dict, id, yoyo)
},
data: {
dict: {},
},
computed: {
list() {
return Object.values(this.dict)
}
}
})
function timeout(t = 1000) {
return new Promise(r => setTimeout(r, t))
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.