File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ export { Simulation };
6969 When using Next.js make sure to include ` 'use client'; ` at the top of the file
7070</Callout >
7171
72- ## Vue
72+ ## Vue 2
7373
7474``` vue title="Simulation.vue"
7575<template>
@@ -94,6 +94,31 @@ export { Simulation };
9494</script>
9595```
9696
97+ ## Vue 3
98+
99+ ``` vue
100+ <template>
101+ <div ref="container" style="width: 100vw; height: 100vh"></div>
102+ </template>
103+
104+ <script setup>
105+ import { onMounted, onBeforeUnmount, ref } from 'vue';
106+ import WebGLFluidEnhanced from 'webgl-fluid-enhanced';
107+
108+ const container = ref(null);
109+ let simulation = null;
110+
111+ onMounted(() => {
112+ simulation = new WebGLFluidEnhanced(container.value);
113+ simulation.start();
114+ });
115+
116+ onBeforeUnmount(() => {
117+ if (simulation) simulation.stop();
118+ });
119+ </script>
120+ ```
121+
97122## Angular
98123
99124``` ts title="simulation.component.ts"
You can’t perform that action at this time.
0 commit comments