MaxLeiter / MaxLeiter/sortablejs-vue3
How to get the new list as an array?
Open
Nobody has claimed this yet.
- Dominant language
- Vue
- Stars
- 413
- Forks
- 27
- PR merge metrics
- No merged PRs in 30d
Description
I have trouble getting the new array list.
here is my code
<template>
<div>
<Sortable :list="elements" item-key="id" tag="div" :options="options" @change="DragableData($event)">
<template #item="{ element, index }">
<div :key="element.id">
{{ index }} - {{ element.name }}
</div>
</template>
</Sortable>
</div>
</template>
<script setup>
const elements = [
{ id: "1", name: "one" },
{ id: "2", name: "two" },
{ id: "3", name: "three" },
{ id: "4", name: "four" },
];
const options = {sort: true};
function DragableData(data) {
console.log(data)
}
</script>
data here does not have any array in it. is it possible to get new array?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the component's @change handler and inspect the event logged by DragableData(data), comparing it with the elements list. Check the library's change-event behavior and determine whether a reordered array is exposed; done means the expected new list can be obtained after dragging.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100