How can I prevent items with a specific identifier from being dragged and then dropped into restricted drop zones?
How would I do this in Vue.js or plain JavaScript?
My HTML code looks like this:
<div draggable="true" id="type-one">Item 1, Type 1</div>
<div draggable="true" id="type-one">Item 2, Type 1</div>
<div draggable="true" id="type-two">Item 1, Type 2</div>
<div draggable="true" id="type-two">Item 2, Type 2</div>
<div id="drop-zone-one">
<!--Only items with id="type-one" are allowed-->
<!--Lock zone and add visual cue when dragging id="type-two"-->
</div>
<div id="drop-zone-two">
<!--Only items with id="type-two" are allowed-->
<!--Lock zone and add visual cue when dragging id="type-one"-->
</div>
My Vue code looks something like this:
<div v-for="(item, index) in itemsListOne" id="item.id">
<div draggable=""true">{{ item.name }}</div>
</div>
<div v-for="(item, index) in itemsListTwo" id="item.id">
<div draggable=""true">{{ item.name }}</div>
</div>
<div id="drop-zone-one">
<!--dropped items-->
</div>
<div id="drop-zone-two">
<!--dropped items-->
</div>
I don't want to use any libraries like Sortable, Draggable, or similar.