Skip to content
New issue

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

explain how work with useMotion #190

Open
sokolovdm opened this issue May 6, 2024 · 0 comments
Open

explain how work with useMotion #190

sokolovdm opened this issue May 6, 2024 · 0 comments

Comments

@sokolovdm
Copy link

sokolovdm commented May 6, 2024

System info

System:
OS: macOS 13.5.2
CPU: (10) x64 Apple M1 Pro
Memory: 29.90 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 14.15.1 - ~/.nvm/versions/node/v14.15.1/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v14.15.1/bin/yarn
npm: 10.5.1 - ~/Documents/projects/persons-web/node_modules/.bin/npm
Watchman: 2022.10.17.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 124.0.6367.119
Safari: 16.6
npmPackages:
@vueuse/motion: ^2.1.0 => 2.1.0
vue: 2.7.16 => 2.7.16

Reproduction

<template lang="pug">
    div(
        :class="styles.root"
    )
        div(
            ref="target"
            :class="styles.balloon"
        )
</template>

<script lang="ts">
import Vue, { computed, PropType, ref, toRefs, useCssModule, watch } from 'vue'
import { MotionDirective, useMotion } from '@vueuse/motion'

import { DynamicIslandSizePresets } from './data'

type Size = keyof typeof DynamicIslandSizePresets

export type DynamicIslandProps = {
    size: Size
}

export default Vue.extend({
    name: 'DynamicIsland',
    props: {
        size: {
            type: String as PropType<DynamicIslandProps['size']>,
            default: 'initial',
        },
    },
    setup(props) {
        const styles = useCssModule()
        const target = ref<HTMLElement>()
        const { variant } = useMotion(target, {
            initial: {
                scale: 1,
                opacity: 0,
            },
            enter: {
                opacity: 1,
            },
        })

        watch(
            () => props.size,
            size => {
                variant.value = size
            }
        )

        return {
            styles,
            target,
            variant,
        }
    },
    directives: {
        // @ts-ignore
        motion: MotionDirective(),
    },
})
</script>

<style module lang="scss" src="./DynamicIsland.module.scss" />

Describe the bug

Hello. Can someone help me? I try to use the useMotion declaration and nothing is happening. What am I doing wrong?
Thanks.

Additional context

No response

Logs

And i have this warning

./node_modules/@vueuse/motion/dist/index.mjs 1588:15-31export 'resolveComponent' (imported as 'resolveComponent') was not found in 'vue' (possible exports: EffectScope, computed, customRef, default, defineAsyncComponent, defineComponent, del, effectScope, getCurrentInstance, getCurrentScope, h, inject, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, mergeDefaults, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, provide, proxyRefs, reactive, readonly, ref, set, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useListeners, useSlots, version, watch, watchEffect, watchPostEffect, watchSyncEffect)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant