Vue only
Since Version 1.2.1
you can also use this module for Vue - instead of Nuxt.
This feature is still experimental and to use with caution.
Please report any issues on the Github Issues Tab
1. Install package
To use with Vue, do not use the auto-install command, since this is a nuxt-specific module install. Instead install the package itself through npm:
npx
npm i v-gsap-nuxt
2. Import directive
In the second step go to your main.ts
file for your vue app, import the Vue plugin and add it to your app after initialization and before mount:
main.ts
import { vGsapVue } from 'v-gsap-nuxt/vue';
// const app = createApp(App);
app.directive('gsap', vGsapVue());
// app.mount('#app');
Configuration
Since global configuration for nuxt happens in nuxt.config.ts
which is not available in Vue, you can add these settings directly during initialization. All props are the same as with nuxt.
main.ts
app.directive('gsap', vGsapVue({
presets: [],
breakpoint: 768,
scroller: '',
composable: true
}));
Table of Contents