Springboot3+Vue3實(shí)現(xiàn)前臺(tái)頁面的設(shè)計(jì)
1.做頁面最重要的東西有哪些?
1.1布局
1.element-plus里面的行列布局el-row、el-col組合
2.flex布局
常見的布局:一般是圖文并茂,宮格(上下),宮格(左右)
1.2樣式
字體大小,顏色,粗細(xì),外邊距,內(nèi)邊距,背景顏色,寬,高,行高,邊:font-size,color,font-weight,margin,padding,background,width,height,line-height,border
2.頁面成品

3.關(guān)鍵代碼
<template> <div style="background-color: #f6f9fc"> <el-menu :default-active="1" class="el-menu-demo" mode="horizontal" > <el-menu-item index="1">系統(tǒng)首頁</el-menu-item> <el-menu-item @click="layout">退出</el-menu-item> </el-menu> <div style="width:80%;margin: 20px auto;"> <div style="font-size: 20px;border-left: 5px solid #2fbd67;padding-left: 10px;height: 30px;line-height: 30px;margin-bottom: 10px">租房公告信息</div> <div> <el-row :gutter="20"> <el-col :span="6" v-for="item in data.tableData" style="margin-bottom: 20px"> <img :src="item.fengMian" alt="" style="width: 100%; height: 250px; border-radius: 5px"> <div style="font-weight: bold;margin-top: 5px">{{item.biaoTi}}</div> <div style="display: flex;align-items: center;margin-top: 10px;grid-gap: 10px"> <img :src="item.faBuRenAvatar" alt="" style="width:30px;height: 30px;border-radius: 50%"> <div style="font-size: 15px">{{item.faBuRen}}</div> <div style="color: #666666">{{ formatTime(item.faBuShiJian) }}</div> </div> </el-col> </el-row> </div> </div> </div> </template> <script setup> import {reactive} from "vue"; import request from "@/utils/request.js"; import {ElMessage, ElMessageBox} from "element-plus"; import dayjs from 'dayjs'; const data=reactive({ huZhuDate:[], fangYuanLeiXing:null, tableData:[], pageNum:1, pageSize:8, total:0, user:JSON.parse(localStorage.getItem('pro1-user') || "{}"), }) // 格式化時(shí)間 const formatTime = (timeStr) => { return dayjs(timeStr).format('YYYY-MM-DD'); // 2025-04-18 // return dayjs(timeStr).format('MM月DD日 HH:mm'); // 04月18日 16:00 }; const layout =()=>{ //清理緩存 localStorage.removeItem('pro1-user') location.href='/login' } const loadHuZhu = () => { request.get('/huzhu/selectAll').then(res => { if (res.code==='200'){ data.huZhuDate=res.data }else { ElMessage.error(res.msg) } }) } loadHuZhu() const load = () => { request.get('/gonggaoxinxi/selectPage',{ params:{ pageNum:data.pageNum, pageSize:data.pageSize, biaoTi:data.biaoTi, } }).then(res=>{ data.tableData=res.data.list data.total=res.data.total }) } load() </script>

浙公網(wǎng)安備 33010602011771號(hào)