Set up pinia
This commit is contained in:
parent
7ac29857ef
commit
160c8a626d
6 changed files with 74 additions and 1 deletions
|
|
@ -14,6 +14,7 @@
|
||||||
"@tailwindcss/vite": "^4.0.0",
|
"@tailwindcss/vite": "^4.0.0",
|
||||||
"@tauri-apps/api": "^2.2.0",
|
"@tauri-apps/api": "^2.2.0",
|
||||||
"@tauri-apps/plugin-opener": "^2.2.5",
|
"@tauri-apps/plugin-opener": "^2.2.5",
|
||||||
|
"pinia": "^2.3.1",
|
||||||
"tailwindcss": "^4.0.0",
|
"tailwindcss": "^4.0.0",
|
||||||
"vue": "^3.5.13"
|
"vue": "^3.5.13"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,18 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Navbar from "./components/Navbar.vue";
|
import Navbar from "./components/Navbar.vue";
|
||||||
|
import Test from "./components/Test.vue";
|
||||||
|
import { useFooStore } from "./stores/foo";
|
||||||
|
|
||||||
|
const foo = useFooStore();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="flex h-screen touch-pan-x touch-pan-y flex-col">
|
<div class="flex h-screen touch-pan-x touch-pan-y flex-col">
|
||||||
<Navbar />
|
<Navbar />
|
||||||
<div class="h-full overflow-auto">
|
<div class="h-full overflow-auto">
|
||||||
|
<Test />
|
||||||
|
<br />
|
||||||
|
Yes, it's now {{ foo.name }}.
|
||||||
<template v-for="_ in 6">
|
<template v-for="_ in 6">
|
||||||
<p class="p-1 font-thin">The quick brown fox Qiii</p>
|
<p class="p-1 font-thin">The quick brown fox Qiii</p>
|
||||||
<p class="p-1 font-extralight">The quick brown fox Qiii</p>
|
<p class="p-1 font-extralight">The quick brown fox Qiii</p>
|
||||||
|
|
|
||||||
10
gdn-app/src/components/Test.vue
Normal file
10
gdn-app/src/components/Test.vue
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { useFooStore } from "@/stores/foo";
|
||||||
|
|
||||||
|
const foo = useFooStore();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
Foo is {{ foo.name }}.
|
||||||
|
<button @click="foo.setName('bar')">Change to bar.</button>
|
||||||
|
</template>
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
|
import { createPinia } from "pinia";
|
||||||
import { createApp } from "vue";
|
import { createApp } from "vue";
|
||||||
import App from "./App.vue";
|
import App from "./App.vue";
|
||||||
|
|
||||||
createApp(App).mount("#app");
|
createApp(App).use(createPinia()).mount("#app");
|
||||||
|
|
|
||||||
12
gdn-app/src/stores/foo.ts
Normal file
12
gdn-app/src/stores/foo.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { defineStore } from "pinia";
|
||||||
|
import { ref } from "vue";
|
||||||
|
|
||||||
|
export const useFooStore = defineStore("foo", () => {
|
||||||
|
const name = ref("foo");
|
||||||
|
|
||||||
|
function setName(to: string) {
|
||||||
|
name.value = to;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { name, setName };
|
||||||
|
});
|
||||||
42
pnpm-lock.yaml
generated
42
pnpm-lock.yaml
generated
|
|
@ -29,6 +29,9 @@ importers:
|
||||||
'@tauri-apps/plugin-opener':
|
'@tauri-apps/plugin-opener':
|
||||||
specifier: ^2.2.5
|
specifier: ^2.2.5
|
||||||
version: 2.2.5
|
version: 2.2.5
|
||||||
|
pinia:
|
||||||
|
specifier: ^2.3.1
|
||||||
|
version: 2.3.1(typescript@5.7.3)(vue@3.5.13(typescript@5.7.3))
|
||||||
tailwindcss:
|
tailwindcss:
|
||||||
specifier: ^4.0.0
|
specifier: ^4.0.0
|
||||||
version: 4.0.0
|
version: 4.0.0
|
||||||
|
|
@ -692,6 +695,9 @@ packages:
|
||||||
'@vue/compiler-vue2@2.7.16':
|
'@vue/compiler-vue2@2.7.16':
|
||||||
resolution: {integrity: sha512-qYC3Psj9S/mfu9uVi5WvNZIzq+xnXMhOwbTFKKDD7b1lhpnn71jXSFdTQ+WsIEk0ONCd7VV2IMm7ONl6tbQ86A==}
|
resolution: {integrity: sha512-qYC3Psj9S/mfu9uVi5WvNZIzq+xnXMhOwbTFKKDD7b1lhpnn71jXSFdTQ+WsIEk0ONCd7VV2IMm7ONl6tbQ86A==}
|
||||||
|
|
||||||
|
'@vue/devtools-api@6.6.4':
|
||||||
|
resolution: {integrity: sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==}
|
||||||
|
|
||||||
'@vue/devtools-core@7.7.1':
|
'@vue/devtools-core@7.7.1':
|
||||||
resolution: {integrity: sha512-W4CRrSZJodNIfrPO7/dXF6ZS0QyOY6PCYVhpSoTSx9+nh2wpZxcS1482lAdKM0FTlaoApHV6jXT95Me90hSaBA==}
|
resolution: {integrity: sha512-W4CRrSZJodNIfrPO7/dXF6ZS0QyOY6PCYVhpSoTSx9+nh2wpZxcS1482lAdKM0FTlaoApHV6jXT95Me90hSaBA==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
|
|
@ -1060,6 +1066,15 @@ packages:
|
||||||
resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==}
|
resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==}
|
||||||
engines: {node: '>=12'}
|
engines: {node: '>=12'}
|
||||||
|
|
||||||
|
pinia@2.3.1:
|
||||||
|
resolution: {integrity: sha512-khUlZSwt9xXCaTbbxFYBKDc/bWAGWJjOgvxETwkTN7KRm66EeT1ZdZj6i2ceh9sP2Pzqsbc704r2yngBrxBVug==}
|
||||||
|
peerDependencies:
|
||||||
|
typescript: '>=4.4.4'
|
||||||
|
vue: ^2.7.0 || ^3.5.11
|
||||||
|
peerDependenciesMeta:
|
||||||
|
typescript:
|
||||||
|
optional: true
|
||||||
|
|
||||||
postcss@8.5.1:
|
postcss@8.5.1:
|
||||||
resolution: {integrity: sha512-6oz2beyjc5VMn/KV1pPw8fliQkhBXrVn1Z3TVyqZxU8kZpzEKhBdmCFqI6ZbmGtamQvQGuU1sgPTk8ZrXDD7jQ==}
|
resolution: {integrity: sha512-6oz2beyjc5VMn/KV1pPw8fliQkhBXrVn1Z3TVyqZxU8kZpzEKhBdmCFqI6ZbmGtamQvQGuU1sgPTk8ZrXDD7jQ==}
|
||||||
engines: {node: ^10 || ^12 || >=14}
|
engines: {node: ^10 || ^12 || >=14}
|
||||||
|
|
@ -1281,6 +1296,17 @@ packages:
|
||||||
vscode-uri@3.0.8:
|
vscode-uri@3.0.8:
|
||||||
resolution: {integrity: sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==}
|
resolution: {integrity: sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==}
|
||||||
|
|
||||||
|
vue-demi@0.14.10:
|
||||||
|
resolution: {integrity: sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
hasBin: true
|
||||||
|
peerDependencies:
|
||||||
|
'@vue/composition-api': ^1.0.0-rc.1
|
||||||
|
vue: ^3.0.0-0 || ^2.6.0
|
||||||
|
peerDependenciesMeta:
|
||||||
|
'@vue/composition-api':
|
||||||
|
optional: true
|
||||||
|
|
||||||
vue-tsc@2.2.0:
|
vue-tsc@2.2.0:
|
||||||
resolution: {integrity: sha512-gtmM1sUuJ8aSb0KoAFmK9yMxb8TxjewmxqTJ1aKphD5Cbu0rULFY6+UQT51zW7SpUcenfPUuflKyVwyx9Qdnxg==}
|
resolution: {integrity: sha512-gtmM1sUuJ8aSb0KoAFmK9yMxb8TxjewmxqTJ1aKphD5Cbu0rULFY6+UQT51zW7SpUcenfPUuflKyVwyx9Qdnxg==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
@ -1870,6 +1896,8 @@ snapshots:
|
||||||
de-indent: 1.0.2
|
de-indent: 1.0.2
|
||||||
he: 1.2.0
|
he: 1.2.0
|
||||||
|
|
||||||
|
'@vue/devtools-api@6.6.4': {}
|
||||||
|
|
||||||
'@vue/devtools-core@7.7.1(vite@6.0.11(@types/node@22.10.10)(jiti@2.4.2)(lightningcss@1.29.1))(vue@3.5.13(typescript@5.7.3))':
|
'@vue/devtools-core@7.7.1(vite@6.0.11(@types/node@22.10.10)(jiti@2.4.2)(lightningcss@1.29.1))(vue@3.5.13(typescript@5.7.3))':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@vue/devtools-kit': 7.7.1
|
'@vue/devtools-kit': 7.7.1
|
||||||
|
|
@ -2212,6 +2240,16 @@ snapshots:
|
||||||
|
|
||||||
picomatch@4.0.2: {}
|
picomatch@4.0.2: {}
|
||||||
|
|
||||||
|
pinia@2.3.1(typescript@5.7.3)(vue@3.5.13(typescript@5.7.3)):
|
||||||
|
dependencies:
|
||||||
|
'@vue/devtools-api': 6.6.4
|
||||||
|
vue: 3.5.13(typescript@5.7.3)
|
||||||
|
vue-demi: 0.14.10(vue@3.5.13(typescript@5.7.3))
|
||||||
|
optionalDependencies:
|
||||||
|
typescript: 5.7.3
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- '@vue/composition-api'
|
||||||
|
|
||||||
postcss@8.5.1:
|
postcss@8.5.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
nanoid: 3.3.8
|
nanoid: 3.3.8
|
||||||
|
|
@ -2369,6 +2407,10 @@ snapshots:
|
||||||
|
|
||||||
vscode-uri@3.0.8: {}
|
vscode-uri@3.0.8: {}
|
||||||
|
|
||||||
|
vue-demi@0.14.10(vue@3.5.13(typescript@5.7.3)):
|
||||||
|
dependencies:
|
||||||
|
vue: 3.5.13(typescript@5.7.3)
|
||||||
|
|
||||||
vue-tsc@2.2.0(typescript@5.7.3):
|
vue-tsc@2.2.0(typescript@5.7.3):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@volar/typescript': 2.4.11
|
'@volar/typescript': 2.4.11
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue