Skip to content

Commit f2a4930

Browse files
ArthurDarkstoneliliang18
andauthored
fix: fix v-draggable type error (#176)
Co-authored-by: liliang18 <[email protected]>
1 parent 4c7aca6 commit f2a4930

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/directive.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,22 @@ const directiveHooks = {
99
}
1010

1111
type VDraggableBinding = [
12-
list: Ref<any[]>,
12+
list: RefOrValue<any[]>,
1313
options?: RefOrValue<UseDraggableOptions<any>>
1414
]
1515

1616
const elementMap: WeakMap<HTMLElement, () => void> = new WeakMap()
1717

1818
export const vDraggable: ObjectDirective<
1919
HTMLElement,
20-
VDraggableBinding | Ref<any[]>
20+
VDraggableBinding | RefOrValue<any[]>
2121
> = {
2222
[directiveHooks.mounted](el, binding) {
2323
const params = isProxy(binding.value) ? [binding.value] : binding.value
2424

25-
const state = useDraggable(el!, ...(params as VDraggableBinding))
25+
const [list, options] = params as VDraggableBinding
26+
27+
const state = useDraggable(el!, list as Ref, options)
2628
elementMap.set(el, state.destroy)
2729
},
2830
[directiveHooks.unmounted](el) {

0 commit comments

Comments
 (0)