We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potentially look in to either adding something like the following snippet to the docs, or as a renderless component
This allows for use with things like firebase where realtime updates can casue some wacky behavior if you implement auto update
This example includes type infetence and is generic for users to implement their own list rendering method with v-for
v-for
<script setup lang="ts" generic="T"> import { vAutoAnimate } from "@formkit/auto-animate/vue"; import { useDragAndDrop } from "@formkit/drag-and-drop/vue"; const props = defineProps<{ itemKey?: keyof T; handle?: string; wrapper?: string; }>(); const model = defineModel<T[]>({ default: [], }); const [parent, items] = useDragAndDrop<T>(model.value, { dragHandle: props.handle || undefined, }); watchDebounced( items, () => { model.value = items.value; }, { deep: true, debounce: 100, } ); </script> <template> <component :is="wrapper || 'div'" v-if="modelValue" ref="parent" v-auto-animate> <template v-for="item of items" :key="typeof item === 'object' ? item[itemKey] : item" > <slot :item /> </template> </component> </template>
Usage:
<script setup lang="ts"> const data = ref(Array(10).map((i) => `item ${i}`)); </script> <template> <Draggable v-model="data" v-slot="{ item }"> <li> {{ item }} </li> </Draggable> </template>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Potentially look in to either adding something like the following snippet to the docs, or as a renderless component
This allows for use with things like firebase where realtime updates can casue some wacky behavior if you implement auto update
This example includes type infetence and is generic for users to implement their own list rendering method with
v-for
Usage:
The text was updated successfully, but these errors were encountered: