feat: 添加 vite-plugin-vue-layouts 插件并更新 vite 版本至 6.0.5
This commit is contained in:
9
src/layouts/default.vue
Normal file
9
src/layouts/default.vue
Normal file
@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<RouterView />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { RouterView } from 'vue-router';
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
@ -8,7 +8,7 @@ async function init() {
|
||||
// https://github.com/antfu-collective/vitesse/blob/47618e72dfba76c77b9b85b94784d739e35c492b/src/modules/README.md
|
||||
type UserPluginContext = { app: import('vue').App<Element> };
|
||||
type UserPlugin = (ctx: UserPluginContext) => void;
|
||||
Object.values(import.meta.glob<{ install: UserPlugin }>('./plugins/**.ts', { eager: true })).forEach((i) =>
|
||||
Object.values(import.meta.glob<{ install: UserPlugin }>('./plugins/*.ts', { eager: true })).forEach((i) =>
|
||||
i.install?.({ app }),
|
||||
);
|
||||
}
|
||||
|
@ -6,4 +6,4 @@ export function install({ app }: { app: import('vue').App<Element> }) {
|
||||
app.use(PiniaColada, {});
|
||||
}
|
||||
|
||||
export * from './counter';
|
||||
export * from '../stores/counter';
|
@ -1,10 +1,11 @@
|
||||
import { DataLoaderPlugin } from 'unplugin-vue-router/data-loaders';
|
||||
import { createRouter, createWebHistory } from 'vue-router';
|
||||
import { setupLayouts } from 'virtual:generated-layouts';
|
||||
import { createRouter, createWebHistory } from 'vue-router/auto';
|
||||
import { handleHotUpdate, routes } from 'vue-router/auto-routes';
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
routes,
|
||||
routes: setupLayouts(routes),
|
||||
strict: true,
|
||||
scrollBehavior: () => ({ left: 0, top: 0 }),
|
||||
});
|
@ -1,5 +0,0 @@
|
||||
/// <reference types="vite/client" />
|
||||
/// <reference types="unplugin-vue-router/client" />
|
||||
/// <reference types="unplugin-vue-macros/macros-global" />
|
||||
/// <reference types="unplugin-icons/types/vue" />
|
||||
/// <reference types="@intlify/unplugin-vue-i18n/messages" />
|
Reference in New Issue
Block a user