diff --git a/src/directive/index.ts b/src/directive/index.ts index 5924ba5a..c74f52df 100644 --- a/src/directive/index.ts +++ b/src/directive/index.ts @@ -7,7 +7,7 @@ import { useMotion } from '../useMotion' import { resolveVariants } from '../utils/directive' import { variantToStyle } from '../utils/transform' -export function directive(variants: MotionVariants = {}): Directive { +export function directive(variants?: MotionVariants): Directive { const register = (el: HTMLElement | SVGElement, binding: DirectiveBinding, node: VNode>) => { // Get instance key if possible (binding value or element key in case of v-for's) const key = (binding.value && typeof binding.value === 'string' ? binding.value : node.key) as string @@ -16,7 +16,7 @@ export function directive(variants: MotionVariants = {}): D if (key && motionState[key]) motionState[key].stop() // Initialize variants with argument - const variantsRef = ref(variants) as Ref> + const variantsRef = ref(variants || {}) as Ref> // Set variants from v-motion binding if (typeof binding.value === 'object') variantsRef.value = binding.value