hejianxian / vddl

🦄 Vue components for modifying lists with the HTML5 drag & drop API.
http://hejx.space/vddl
MIT License
395 stars 75 forks source link

I don't want to change the id #36

Open cn-xufei opened 6 years ago

cn-xufei commented 6 years ago

https://github.com/hejianxian/vddl/blob/85806a3f84aff3e1d986ad1dd5b28d3c8c334f9d/example/src/views/simple.vue#L131-L144

pschaub commented 6 years ago

You may duplicate the id of all items to another field (e.g. item.vddlId) before using it with vddl. Then you can only change the vddl-internal id (item.vddlId) on that function. Just an idea as workaround.

Hint: The fastest way to deep-copy anything in javascript is this:

let realClone = JSON.parse(JSON.stringify(obj))

Source: https://stackoverflow.com/questions/122102/what-is-the-most-efficient-way-to-deep-clone-an-object-in-javascript