Skip to content

How to add item to the list or remove item from the list? #110

Open
@theodol59

Description

@theodol59

Good afternoon,

Every item in my list has a remove button. When I press it, I want item to be removed.
Additionally, I have a need to add items to my current rendered Sortable component.

It seems that Sortable component doesn't react to removals or additions. In order for Sortable to update itself with new "list" value, I need to pass unique Vue "key" property to Sortable component. Only then Sortable component re-renders itself... But it has many drawbacks as every item looses its rendering state...

Could you give me an example (based on https://github.com/MaxLeiter/sortablejs-vue3/blob/main/src/examples/WithStore.vue) how to add an item to the fruits list and how to remove a fruit from the list so that other items are not mounted again?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions