hcg1023 / vue3-dnd

React Dnd implementation in Vue Composition-api.
https://www.vue3-dnd.com
MIT License
642 stars 52 forks source link

拖拽会执行多次onUpdated #40

Closed bbfpl closed 2 years ago

bbfpl commented 2 years ago

` .... const setRef = (el: HTMLDivElement) => { card.value = drag(drop(el)) as HTMLDivElement }

onMounted(() => { console.log('创建') }) onUnmounted(() => { console.log('销毁') }) onUpdated(() => { console.log('更新') }) ` 这个代码是examples\04-sortable\simple\Card.vue 里就可以复现的,想知道为什么拖拽会导致更新

hcg1023 commented 2 years ago

在这个示例中,每次移动都会实时改变数据的index,所以会触发onUpdated