Skip to content

Commit

Permalink
fix(example): clean up Nuxt example & fix type-checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Joepocalyptic committed Aug 20, 2023
1 parent 5b4de3a commit 4a93b5d
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 53 deletions.
1 change: 1 addition & 0 deletions apps/nuxt3/.npmrc
@@ -0,0 +1 @@
shamefully-hoist=true
89 changes: 45 additions & 44 deletions apps/nuxt3/app.vue
@@ -1,55 +1,56 @@
<template>
<div>
<NuxtWelcome />
<vue-particles
id="tsparticles"
:options="options"
:particles-init="particlesInit"
/>
</div>
<div>
<NuxtWelcome />
<vue-particles
id="tsparticles"
:options="options"
:particles-init="particlesInit"
@particles-loaded="particlesLoaded"
/>
</div>
</template>
<script>
<script setup lang="ts">
import { loadFull } from "tsparticles";
import type { IOptions } from "tsparticles-engine";
import {Container} from "tsparticles-engine";
export default {
name: "NuxtTutorial",
data() {
return {
options: {
background: {
color: "#fff"
},
fullScreen: {
enable: true,
zIndex: -1
},
particles: {
color: {
value: "#000"
},
links: {
color: "#000",
enable: true
},
move: {
enable: true
},
number: {
value: 100
}
}
}
};
const options = {
background: {
color: "#fff"
},
fullScreen: {
enable: true,
zIndex: -1
},
particles: {
color: {
value: "#000"
},
methods: {
particlesInit: async (engine) => {
await loadFull(engine);
}
links: {
color: "#000",
enable: true
},
move: {
enable: true
},
number: {
value: 100
}
};
}
} as IOptions
const particlesInit = async (engine) => {
await loadFull(engine)
console.log(engine)
}
const particlesLoaded = (container: Container) => {
console.log(toRaw(container))
}
</script>
<style>
.bg-white {
background: none !important;
background: none !important;
}
</style>
9 changes: 1 addition & 8 deletions apps/nuxt3/nuxt.config.ts
@@ -1,11 +1,4 @@
import { defineNuxtConfig } from 'nuxt/config'

// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
plugins: [
{
src: '~/plugins/vue3-particles.ts',
mode: 'client',
},
],
})
export default defineNuxtConfig({})
1 change: 1 addition & 0 deletions apps/nuxt3/package.json
Expand Up @@ -35,6 +35,7 @@
"nuxt": "^3.6.5",
"prettier": "^3.0.1",
"tsparticles": "^2.12.0",
"tsparticles-engine": "^2.12.0",
"typescript": "^5.1.6",
"vue": "^3.3.4",
"vue3-particles": "workspace:^",
Expand Down
1 change: 0 additions & 1 deletion apps/nuxt3/shim-vue3-particles.d.ts

This file was deleted.

0 comments on commit 4a93b5d

Please sign in to comment.