+
@@ -21,8 +21,8 @@ const onClickLeft = () => history.back()
This is a simple example of Unocss in action.
-
- Click me
+
+ Button
diff --git a/src/router/README.md b/src/router/README.md
index f2cb011..0f8058e 100644
--- a/src/router/README.md
+++ b/src/router/README.md
@@ -1,8 +1,8 @@
# `File-based Routing`
-Routes will be auto-generated for Vue files in the **src/views** dir with the same file structure.
+Routes will be auto-generated for Vue files in the **src/pages** dir with the same file structure.
Check out [`unplugin-vue-router`](https://github.com/posva/unplugin-vue-router) for more details.
-在 **src/views** 目录下的 Vue 文件会自动生成相同结构的路由。
+在 **src/pages** 目录下的 Vue 文件会自动生成相同结构的路由。
查看[`unplugin-vue-router`](https://github.com/posva/unplugin-vue-router)了解更多细节。
diff --git a/src/router/index.ts b/src/router/index.ts
index 011d5da..a709dda 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -1,4 +1,5 @@
import { createRouter, createWebHistory } from 'vue-router/auto'
+import { setupLayouts } from 'virtual:generated-layouts'
import NProgress from 'nprogress'
import useRouteTransitionNameStore from '@/stores/modules/routeTransitionName'
@@ -8,6 +9,7 @@ NProgress.configure({ showSpinner: true, parent: '#app' })
const router = createRouter({
history: createWebHistory(import.meta.env.VITE_APP_PUBLIC_PATH),
+ extendRoutes: routes => setupLayouts(routes),
})
router.beforeEach((to, from, next) => {
diff --git a/src/typed-router.d.ts b/src/typed-router.d.ts
index f841204..0220b95 100644
--- a/src/typed-router.d.ts
+++ b/src/typed-router.d.ts
@@ -40,6 +40,7 @@ import type {
declare module 'vue-router/auto/routes' {
export interface RouteNamedMap {
'main': RouteRecordInfo<'main', '/', Record
, Record>,
+ '/[...all]': RouteRecordInfo<'/[...all]', '/:all(.*)', { all: ParamValue }, { all: ParamValue }>,
'charts': RouteRecordInfo<'charts', '/charts', Record, Record>,
'counter': RouteRecordInfo<'counter', '/counter', Record, Record>,
'mock': RouteRecordInfo<'mock', '/mock', Record, Record>,
diff --git a/src/views/index.vue b/src/views/index.vue
deleted file mode 100644
index 1088e62..0000000
--- a/src/views/index.vue
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 🚀 欢迎补充
-
- PR
-
-
-
-
-
-
diff --git a/tsconfig.json b/tsconfig.json
index 3bcec39..ec20ca8 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -10,7 +10,11 @@
"paths": {
"@/*": ["src/*"]
},
- "types": ["node"],
+ "types": [
+ "node",
+ "unplugin-vue-router/client",
+ "vite-plugin-vue-layouts/client"
+ ],
"allowJs": true,
"strictNullChecks": false,
"noImplicitAny": false,
diff --git a/uno.config.ts b/uno.config.ts
index fd671e5..ec60c97 100644
--- a/uno.config.ts
+++ b/uno.config.ts
@@ -15,18 +15,10 @@ export default defineConfig({
// https://juejin.cn/post/7262975395620618298
baseFontSize: 4,
}),
- presetMini({
- dark: {
- dark: '.van-theme-dark',
- light: '.van-theme-light',
- },
- }),
+ presetMini(),
],
- shortcuts: {
+ shortcuts: [
// shortcuts to multiple utilities
- 'btn': 'py-2 px-4 font-semibold rounded-lg shadow-md',
- 'btn-green': 'text-white bg-green-500 hover:bg-green-700',
- 'btn-blue': 'text-white bg-blue-500 hover:bg-blue-700',
- 'centered': 'absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2',
- },
+ ['btn', 'px-6 py-3 rounded-3 border-none inline-block bg-green-400 text-white cursor-pointer !outline-none hover:bg-green-600 disabled:cursor-default disabled:bg-gray-600 disabled:opacity-50'],
+ ],
})