Files
vue-ts-example/src/main.ts
严浩 8b4b361c7c
All checks were successful
CI / cache-and-install (push) Successful in 1m36s
feat: Add persist option to useCounterStore
2024-09-11 10:47:54 +08:00

38 lines
1.0 KiB
TypeScript

import './assets/main.css';
import 'virtual:uno.css';
import { createHead } from '@unhead/vue';
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
import { DataLoaderPlugin } from 'unplugin-vue-router/data-loaders';
import App from './App.vue';
import { router } from './router';
async function init() {
if (import.meta.env.MODE === 'development' || 1 === 1) {
// TODO: https://github.com/hu3dao/vite-plugin-debug/
// https://eruda.liriliri.io/zh/docs/#快速上手
await import('eruda').then(({ default: eruda }) => {
eruda.init({
defaults: {
transparency: 0.9,
},
});
// eruda.show();
});
}
const app = createApp(App)
.use(createHead())
.use(createPinia().use(piniaPluginPersistedstate))
// Register the plugin before the router
.use(DataLoaderPlugin, { router })
// adding the router will trigger the initial navigation
.use(router);
app.config.globalProperties.$__DEV__ = $__DEV__;
app.mount('#app');
}
init();