From 44e487bb97ce4f3f7d852c9fce8475c1896cd7dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9C=89=E6=9D=A5=E6=8A=80=E6=9C=AF?= <1490493387@qq.com>
Date: Tue, 16 Nov 2021 23:47:47 +0800
Subject: [PATCH] =?UTF-8?q?feat:=E7=AE=80=E5=8D=95Layout=E5=B8=83=E5=B1=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 122 +++++++++++++++++-----------------
src/App.vue | 2 -
src/layout/index.vue | 57 ++++++++++++++++
src/router/index.ts | 22 +++---
src/views/dashboard/index.vue | 13 ++++
vite.config.ts | 4 ++
6 files changed, 148 insertions(+), 72 deletions(-)
create mode 100644 src/layout/index.vue
create mode 100644 src/views/dashboard/index.vue
diff --git a/README.md b/README.md
index 07fe6f7b..2218fed6 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,8 @@
- vue-router4 : https://next.router.vuejs.org/zh/introduction.html
+- element-plus: https://element-plus.gitee.io/zh-CN/
+
## Vite项目构建
@@ -210,80 +212,27 @@ TS配置别名路径,否则使用别名路径会报错,下面关键配置 `b
```
-## HelloWorld.vue
-```typescript
-
-
- 点击+1
-
-
-
-```
-
-## App.vue
-
-```typescript
-
-
-
-
-
-
-
-
-```
## Vite 环境变量配置
**官方环境变量配置文档:** https://cn.vitejs.dev/guide/env-and-mode.html
-#### 多环境配置
+#### 配置文件
-开发环境变量文件:`.env.development`
+在项目根目录分别添加 `开发环境配置` 、 `生产环境配置`和`模拟环境配置`文件
+
+开发环境配置:`.env.development`
```properties
-# 开发环境变量
-
-# 变量必须以 VITE_ 为前缀才能暴露给外部读取
-
+# 开发环境变量 注意:变量必须以 VITE_ 为前缀才能暴露给外部读取
VITE_APP_TITLE = '管理系统'
VITE_APP_PORT = 3000
VITE_APP_BASE_API = '/dev-api'
-
```
-生产环境变量文件:`.env.production`
+生产环境配置:`.env.production`
```properties
# 生产环境变量
@@ -293,7 +242,7 @@ VITE_APP_BASE_API = '/prod-api'
```
-模拟环境变量文件:`.env.staging`
+模拟环境配置:`.env.staging`
```properties
# 模拟环境变量
@@ -474,5 +423,58 @@ export default service
+## HelloWorld.vue
+
+```typescript
+
+
+ 点击+1
+
+
+
+```
+
+## App.vue
+
+```typescript
+
+
+
+
+
+
+
+
+```
+
diff --git a/src/App.vue b/src/App.vue
index 8fd9ce74..35ba8bd6 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,6 +1,5 @@
-
@@ -11,6 +10,5 @@
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
- margin-top: 60px;
}
diff --git a/src/layout/index.vue b/src/layout/index.vue
new file mode 100644
index 00000000..11cade38
--- /dev/null
+++ b/src/layout/index.vue
@@ -0,0 +1,57 @@
+
+
+ Header
+
+ Aside
+
+
+
+
+ Footer
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/router/index.ts b/src/router/index.ts
index bf45d983..83c4b056 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -1,17 +1,19 @@
import {createRouter, createWebHashHistory, RouteRecordRaw} from 'vue-router'
-import HelloWord from '../components/HelloWorld.vue'
+import Layout from '@/layout/index.vue'
const routes: Array = [
{
- path: '',
- redirect: (_) => {
- return {path: '/home'}
- }
- },
- {
- path: '/home',
- name: 'HelloWord',
- component: HelloWord
+ path: '/',
+ component: Layout,
+ redirect: '/dashboard',
+ children: [
+ {
+ path: 'dashboard',
+ component: () => import('@views/dashboard/index.vue'),
+ name: 'Dashboard',
+ meta: {title: '首页', icon: 'dashboard', affix: true}
+ }
+ ]
}
]
diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue
new file mode 100644
index 00000000..850650c3
--- /dev/null
+++ b/src/views/dashboard/index.vue
@@ -0,0 +1,13 @@
+
+ 这里是控制台
+
+
+
+
+
\ No newline at end of file
diff --git a/vite.config.ts b/vite.config.ts
index d80c66a9..dfb0fd4a 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -41,6 +41,10 @@ export default defineConfig({
{
find:"@utils",
replacement: path.resolve("./src/utils")
+ },
+ {
+ find:"@views",
+ replacement: path.resolve("./src/views")
}
]
}