赞
踩
global.css 初始化一些样式 variable.scss目前内容为空
这里使用网上比较全的reset样式
/* 全局样式表 */ *, *:after, *:before { box-sizing: border-box; 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, summary, time, mark, audio, video { font : inherit; font-size: 100%; margin : 0; padding: 0; vertical-align: baseline; border: 0; } article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; } body { line-height: 1; } ol, ul { list-style: none; } blockquote, q { quotes: none; &:before, &:after { content: ''; content: none; } } sub, sup { font-size : 75%; line-height: 0; position: relative; vertical-align: baseline; } sup { top: -.5em; } sub { bottom: -.25em; } table { border-spacing : 0; border-collapse: collapse; } input, textarea, button { font-family: inhert; font-size : inherit; color: inherit; } select { text-indent : .01px; text-overflow: ''; border : 0; border-radius: 0; -webkit-appearance: none; -moz-appearance : none; appearance : none; } select::-ms-expand { display: none; } code, pre { font-family: monospace, monospace; font-size : 1em; }
1.2.1 在main.ts引入 样式表 和路由设置
1.2.2 vite.config.ts 添加对css全局变量文件的配置
import {createRouter, createWebHashHistory,RouteRecordRaw} from "vue-router" import Home from '@/views/layout/index.vue' import User from "@/views/user/User.vue" import System from '@/views/system/System.vue' // 引入 login.ts import LoginRouter from '@/router/modules/login.ts' //RouteRecordRaw 内置的接口类型 const routes: Array<RouteRecordRaw> = [ ... LoginRouter, { path:'/', redirect:'/home' }, { path:'/home', name: "首页", component:Home, children:[ { path:'/user', name: "用户管理", component:User }, { path:'/sys', name: "系统", component:System }, ] }, ] const router = createRouter({ history: createWebHashHistory(), routes }) // 导出路由 export default router
login.ts
import Login from '@/views/login/Login.vue'
import {RouteRecordRaw} from "vue-router";
//RouteRecordRaw 内置的接口类型
const loginView: Array<RouteRecordRaw> = [
{
path: '/login',
name:'登录页',
component: Login,
meta: {
title: '登录页'
}
}
]
export default loginView;
2.1 基础布局
http://element-plus.org/zh-CN/component/container.html 在element plus官网选择适合的布局
在layout文件夹下的index.vue 把布局代码复制进去,并自己调整一下样式测试效果
<template> <div class="common-layout"> <el-container> <el-aside class="layout-menu">Aside</el-aside> <el-container> <el-header class="layout-header">Header</el-header> <el-main class="layout-main">Main</el-main> </el-container> </el-container> </div> </template> <script setup lang="ts"> </script> <style scoped lang="scss"> .common-layout{ .layout-menu{ color: white; border-right: 1px solid #E4E7ED; width: 260px ; height: 100vh; background-color:#001529 ; } .layout-header{ color: white; height: 50px; background-color: cadetblue ; } .layout-main{ color: white; height: 50px; background-color: cornflowerblue ; } } </style>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。