From 1f52d0c047f07654002634a00615c6c1313a51c0 Mon Sep 17 00:00:00 2001 From: fwb Date: Thu, 5 Dec 2024 18:03:32 +0800 Subject: [PATCH] =?UTF-8?q?'layout=E6=A1=86=E6=9E=B6'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/index.vue | 57 +++++++++ src/main.ts | 11 +- src/router/routes.ts | 6 +- src/styles/index.scss | 19 ++- src/styles/reset.scss | 253 +++++++++++++++++++++----------------- src/styles/variable.scss | 21 +++- src/views/404/index.vue | 27 +++- src/views/home/index.vue | 18 ++- src/views/login/index.vue | 2 +- 9 files changed, 277 insertions(+), 137 deletions(-) create mode 100644 src/layout/index.vue diff --git a/src/layout/index.vue b/src/layout/index.vue new file mode 100644 index 0000000..764b16a --- /dev/null +++ b/src/layout/index.vue @@ -0,0 +1,57 @@ + + + + + \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index f4176cc..556c8e9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,10 +8,15 @@ import zhCn from 'element-plus/es/locale/lang/zh-cn' //引入路由 import router from '@/router' - +//引入仓库 import pinia from '@/store' import App from '@/App.vue' +//svg插件需要配置代码 +import 'virtual:svg-icons-register' +//引入模板的全局的样式 +import '@/styles/index.scss' + //获取应用实例对象 const app = createApp(App) for (const [key, component] of Object.entries(ElementPlusIconsVue)) { @@ -34,9 +39,7 @@ app.use(ElementPlus, { // }, // }) -//svg插件需要配置代码 -import 'virtual:svg-icons-register' -import '@/styles/index.scss' + app.use(router) app.use(pinia) // 将应用挂载到挂载点上 diff --git a/src/router/routes.ts b/src/router/routes.ts index b0ade29..c0a6608 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -2,13 +2,13 @@ export const constantRoute = [ { name: 'login', - path: '/', + path: '/login', component: () => import('@/views/login/index.vue'), }, { name: 'home', - path: '/home', - component: () => import('@/views/home/index.vue'), + path: '/', + component: () => import('@/layout/index.vue'), }, { name: '404', diff --git a/src/styles/index.scss b/src/styles/index.scss index 57fb3ed..693730b 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,3 +1,18 @@ //引入清除默认样式 -@import "reset"; -//设置scss全局变量 +@import './reset.scss'; + +//滚动条外观设置 +::-webkit-scrollbar { + width: 10px; +} + +::-webkit-scrollbar-track { + //background: $base-menu-background; + background: white; +} + +::-webkit-scrollbar-thumb{ + width: 10px; + background-color: whitesmoke; + border-radius: 10px; +} \ No newline at end of file diff --git a/src/styles/reset.scss b/src/styles/reset.scss index f87e115..110c085 100644 --- a/src/styles/reset.scss +++ b/src/styles/reset.scss @@ -1,161 +1,186 @@ -* { +*, +*:after, +*:before { box-sizing: border-box; - background-repeat: no-repeat; - -webkit-tap-highlight-color: rgba(0,0,0,0); -} -body { - margin: 0; - line-height: 1; + outline: none; } +html, +body, +div, +span, +applet, +object, +iframe, +h1, +h2, +h3, +h4, +h5, +h6, +p, +blockquote, +pre, +a, +abbr, +acronym, +address, +big, +cite, +code, +del, +dfn, +em, +img, +ins, +kbd, +q, +s, +samp, +small, +strike, +strong, +sub, +sup, +tt, +var, +b, +u, +i, +center, +dl, +dt, +dd, +ol, +ul, +li, +fieldset, +form, +label, +legend, +table, +caption, +tbody, +tfoot, +thead, +tr, +th, +td, article, aside, +canvas, +details, +embed, +figure, +figcaption, footer, header, +hgroup, +menu, nav, +output, +ruby, section, -main, -figcaption, -figure, -menu, -details { - display: block; -} - +summary, +time, +mark, audio, -canvas, video { - display: inline-block; -} - -img { - display: block; - border: 0; -} + font: inherit; + font-size: 100%; -h1, -h2, -h3, -h4, -h5, -h6 { margin: 0; padding: 0; - font-weight: normal; + + vertical-align: baseline; + + border: 0; } -p { - margin: 0; - padding: 0; +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +menu, +nav, +section { + display: block; } -address, -cite, -dfn, -em, -var { - font-style: normal; +body { + line-height: 1; } -ul, -ol { - margin: 0; - padding: 0; - list-style-type: none; +ol, +ul { + list-style: none; } -a { - background-color: transparent; - font-size: inherit; - color: inherit; - text-decoration: none; +blockquote, +q { + quotes: none; - &:active, - &:hover { - outline: 0; + &:before, + &:after { + content: ''; + content: none; } } -:focus { - outline: 0; -} +sub, +sup { + font-size: 75%; + line-height: 0; -button, -input, -select, -textarea { - margin: 0; - font-size: inherit; -} + position: relative; -button, -html [type="button"], -[type="reset"], -[type="submit"] { - padding: 0; - border: 0; - color: inherit; - background-color: transparent; - -webkit-appearance: button; - cursor: pointer; + vertical-align: baseline; } -button::-moz-focus-inner, -input::-moz-focus-inner { - border: 0; - padding: 0; +sup { + top: -.5em; } -input { - padding: 0; - line-height: normal; - - &::-webkit-input-placeholder { - font-weight: 300; - } - - &::-ms-input-placeholder { - font-weight: 300; - } +sub { + bottom: -.25em; +} - &::-moz-placeholder { - font-weight: 300; - } +table { + border-spacing: 0; + border-collapse: collapse; } -[type="number"] { - -moz-appearance: textfield; +input, +textarea, +button { + font-family: inhert; + font-size: inherit; - &::-webkit-inner-spin-button, - &::-webkit-outer-spin-button { - margin: 0; - height: auto; - -webkit-appearance: none; - } + color: inherit; } -[type="search"] { - -webkit-appearance: textfield; +select { + text-indent: .01px; + text-overflow: ''; - &::-webkit-search-cancel-button, - &::-webkit-search-decoration { - -webkit-appearance: none; - } -} + border: 0; + border-radius: 0; -textarea { - overflow: auto; - resize: none; -webkit-appearance: none; + -moz-appearance: none; } -select { - -webkit-appearance: none; - background-color: #fff; +select::-ms-expand { + display: none; } -table { - border-collapse: collapse; - border-spacing: 0; +code, +pre { + font-family: monospace, monospace; + font-size: 1em; } \ No newline at end of file diff --git a/src/styles/variable.scss b/src/styles/variable.scss index 8f7b94b..942d113 100644 --- a/src/styles/variable.scss +++ b/src/styles/variable.scss @@ -1,4 +1,17 @@ -//引入清除默认样式 -@import "reset"; -//给项目scss提供全局变量 -$h1-color:green; \ No newline at end of file +//项目提供scss全局变量 +//定义项目主题颜色 + +//左侧的菜单的宽度 +$base-menu-width:260px; +//左侧菜单的背景颜色 +$base-menu-background:darkslateblue; +$base-menu-min-width:50px; + +// 顶部导航的高度 +$base-tabbar-height:50px; + +//左侧菜单logo高度设置 +$base-menu-logo-height:50px; + +//左侧菜单logo右侧文字大小 +$base-logo-title-fontSize:20px; \ No newline at end of file diff --git a/src/views/404/index.vue b/src/views/404/index.vue index b2a3abf..4f15b95 100644 --- a/src/views/404/index.vue +++ b/src/views/404/index.vue @@ -1,7 +1,24 @@ - - + + diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 143e6f1..2996add 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -1,7 +1,17 @@ - - + + diff --git a/src/views/login/index.vue b/src/views/login/index.vue index b5a58f4..452a13a 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -78,7 +78,7 @@ const loginHandle = async () => { // 登录成功后设置一个2秒的延迟来跳转页面 setTimeout(() => { // 跳转到首页 - $router.push('/home') + $router.push('/') // 结束加载效果 loading.value = false }, 1000) // 2000 毫秒 = 2 秒