SortableJS / vue.draggable.next

Vue 3 compatible drag-and-drop component based on Sortable.js
https://sortablejs.github.io/vue.draggable.next/#/simple
MIT License
3.91k stars 531 forks source link

v-model not defined @change event after compiling for production using Laravel Mix #155

Closed ericamigo closed 2 years ago

ericamigo commented 2 years ago

image

sorry for not following the guidelines in submitting new issue.

anybody encountered the same issue in Laravel? i'm using inertia+vue3


SOLVED

if you're using a props from back-end directly to your v-model, wrap it with ref() and use it in your v-model.

in my case...

<template>
  <draggable v-model="sortableList"></draggable>
</template>

<script setup>
import { ref } from 'vue'
import draggable from 'vuedraggable'

let props = defineProps({
  menuItems: Array,
})

let sortableList = ref(props.menuItems)
</script>

not sure if there's a different approach but since this is working for me, i'll use this for now