Skip to content

docs: useSortable - incorrect usage of the argument on moveArrayElement #4902

@icarusgk

Description

@icarusgk

Inside the Tips section of the useSortable composable, the current docs passes the list as list.value, but when used this way, the moveArrayElement doesn't work, unless we pass the list as a ref itself.

  • Current way (✖︎ Doesn't work)
import { moveArrayElement } from '@vueuse/integrations/useSortable'

useSortable(el, list, {
  onUpdate: (e) => {
    moveArrayElement(list.value, e.oldIndex, e.newIndex, e)
  }
})
  • Suggested way (✅ Works)
import { moveArrayElement } from '@vueuse/integrations/useSortable'

useSortable(el, list, {
  onUpdate: (e) => {
    moveArrayElement(list, e.oldIndex, e.newIndex, e)
  }
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy