Skip to content

Commit 64edfc0

Browse files
committed
added vuetify and pinia stores
1 parent 413f884 commit 64edfc0

File tree

8 files changed

+311
-10
lines changed

8 files changed

+311
-10
lines changed

components/DarkMode.vue

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<script setup lang="ts">
2+
import { useTheme } from "vuetify";
3+
import {useMainStore} from "~/stores/main.ts";
4+
const theme = useTheme();
5+
const store = useMainStore();
6+
const {darkMode} = toRefs(store);
7+
console.log("darkMode", darkMode);
8+
function toggleTheme() {
9+
theme.global.name.value = theme.global.current.value.dark ? "light" : "dark";
10+
}
11+
</script>
12+
13+
14+
<template>
15+
<v-btn icon @click="toggleTheme" :ripple="false">
16+
<v-icon v-if="theme.global.current.value.dark" medium>mdi-weather-night</v-icon>
17+
<v-icon v-else small>mdi-white-balance-sunny</v-icon>
18+
</v-btn>
19+
</template>

layouts/default.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
<template>
3+
<v-app>
4+
<slot/>
5+
</v-app>
6+
</template>
7+

nuxt.config.ts

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
11
// https://nuxt.com/docs/api/configuration/nuxt-config
2+
3+
import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify';
24
export default defineNuxtConfig({
3-
devtools: { enabled: true },
5+
6+
devtools: {
7+
enabled: true,
8+
9+
timeline: {
10+
enabled: true,
11+
},
12+
},
13+
build: {
14+
transpile: ['vuetify'],
15+
},
416
modules: [
17+
(_options, nuxt) => {
18+
nuxt.hooks.hook('vite:extendConfig', (config) => {
19+
// @ts-expect-error
20+
config.plugins.push(vuetify({ autoImport: true }));
21+
});
22+
},
523
'@pinia/nuxt',
24+
'@pinia-plugin-persistedstate/nuxt',
25+
'@nuxt/devtools',
626
],
27+
vite: {
28+
vue: {
29+
template: {
30+
transformAssetUrls,
31+
},
32+
},
33+
},
734
});

0 commit comments

Comments
 (0)