Skip to content

Commit fb8a002

Browse files
committed
added Pinia for state management & made a store folder for global states
1 parent 6a852fa commit fb8a002

File tree

7 files changed

+86
-4
lines changed

7 files changed

+86
-4
lines changed

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta charset="UTF-8" />
66
<link rel="icon" href="/favicon.ico" />
77
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8-
<title>Vuetify 3 Vite Preview</title>
8+
<title>CircuitVerse - Vue</title>
99
</head>
1010

1111
<body>

package-lock.json

+70-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
},
1111
"dependencies": {
1212
"@mdi/font": "5.9.55",
13+
"pinia": "^2.0.14",
1314
"roboto-fontface": "*",
1415
"vue": "^3.2.25",
1516
"vue-router": "^4.0.15",

public/favicon.ico

84.9 KB
Binary file not shown.

src/components/Home.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<v-layout>
33
<v-navigation-drawer color="grey-darken-2" permanent></v-navigation-drawer>
44
<v-app-bar color="grey-lighten-2">
5-
<h2>Welcome to CicuitVerse Home Page</h2>
5+
<h2>{{ title }}</h2>
66
</v-app-bar>
77
<v-main>
88
<v-card height="200px"></v-card>
@@ -12,4 +12,8 @@
1212

1313
<script lang="ts" setup>
1414
15+
import { HomeStore } from '../store/Home'
16+
17+
const main = HomeStore();
18+
const { title } = main
1519
</script>

src/main.ts

+2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import { createApp } from 'vue'
22
import App from './App.vue'
33
import vuetify from './plugins/vuetify'
44
import router from './router/index.js'
5+
import { createPinia } from 'pinia'
56
import { loadFonts } from './plugins/webfontloader'
67

78
loadFonts()
89

910
createApp(App)
1011
.use(vuetify)
1112
.use(router)
13+
.use(createPinia())
1214
.mount('#app')

src/store/Home.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineStore } from "pinia";
2+
3+
export const HomeStore = defineStore('main', {
4+
state: () => ({
5+
title: "Welcome to CircuitVerse Home Page",
6+
})
7+
})

0 commit comments

Comments
 (0)