1- <!-- 主页面 -->
1+ <!-- 核心布局 -->
22<template >
33 <div class =" layout" >
4- <div ref = " mainheader " class =" layout-header" >
4+ <div class =" layout-header" >
55 <el-row >
66 <el-col :xs =" 10" :sm =" 12" :md =" 14" :lg =" 16" :xl =" 18" >
77 <div class =" system-info" >
2929 </el-col >
3030 </el-row >
3131 </div >
32- <div :style = " {height:contentHeight} " class =" layout-main" >
32+ <div class =" layout-main" >
3333 <router-view />
3434 </div >
35- <div ref = " mainfooter " class =" layout-footer" >
35+ <div class =" layout-footer" >
3636 <a href =" https://github.com/calebman/vue-DBM" >
3737 点此进入代码仓库
3838 </a >
4242
4343<script >
4444export default {
45- name: " dbm-main " ,
45+ name: " layout1 " ,
4646 components: {},
4747 data () {
48- return {
49- contentHeight: " 100px"
50- };
48+ return {};
5149 },
5250 props: {},
5351 computed: {
@@ -65,17 +63,6 @@ export default {
6563 }
6664 },
6765 methods: {
68- computeContentHeight () {
69- let headerHeight = this .$refs [" mainheader" ]
70- ? this .$refs [" mainheader" ].offsetHeight
71- : null ;
72- headerHeight = headerHeight ? headerHeight : 65 ;
73- let footerHeight = this .$refs [" mainfooter" ]
74- ? this .$refs [" mainfooter" ].offsetHeight
75- : null ;
76- footerHeight = footerHeight ? footerHeight : 60 ;
77- return ` ${ window .innerHeight - (headerHeight + footerHeight + 5 )} px` ;
78- },
7966 userCommand (command ) {
8067 switch (command) {
8168 case " usercenter" :
@@ -86,93 +73,87 @@ export default {
8673 }
8774 },
8875 watch: {},
89- mounted () {
90- let self = this ;
91- self .contentHeight = self .computeContentHeight ();
92- window .onresize = function () {
93- self .contentHeight = self .computeContentHeight ();
94- };
95- },
9676 created () {}
9777};
9878 </script >
9979
10080<style lang="less" scoped>
10181.layout {
102- // border: 1px solid #d7dde4;
103- background : #f5f7f9 ;
104- position : relative ;
105- // border-radius: 4px;
106- overflow : hidden ;
107- }
108-
109- .layout-header {
110- background : #495060 ;
11182 width : 100% ;
11283 height : 100% ;
113- line-height : 64px ;
114- .system-tools {
115- text-align : right ;
116- .d-icon-tongzhi {
117- font-size : 24px ;
118- color : #fff ;
119- cursor : pointer ;
120- }
84+ margin : 0 auto ;
85+ background : #f5f7f9 ;
86+ .layout-header ,
87+ .layout-main ,
88+ .layout-footer {
89+ position : absolute ;
90+ width : 100% ;
12191 }
122- .system-info {
123- text-align : left ;
124- .logo {
125- width : 40px ;
126- height : 40px ;
127- border-radius : 50px ;
128- margin-top : 12px ;
129- margin-left : 20px ;
130- margin-right : 10px ;
131- float : left ;
132- position : relative ;
133- }
134- .title {
135- font-size : 18px ;
136- font-weight : bold ;
137- color : azure ;
138- line-height : 64px ;
92+ .layout-header {
93+ background : #495060 ;
94+ line-height : 64px ;
95+ height : 64px ;
96+ top : 0 ;
97+ .system-tools {
98+ text-align : right ;
99+ .d-icon-tongzhi {
100+ font-size : 24px ;
101+ color : #fff ;
102+ cursor : pointer ;
103+ }
139104 }
140- }
141- .system-user {
142- text-align : right ;
143- margin-right : 5px ;
144- .userinfo-inner {
145- cursor : pointer ;
146- color : #fff ;
147- img {
105+ .system-info {
106+ text-align : left ;
107+ .logo {
148108 width : 40px ;
149109 height : 40px ;
150- border-radius : 20px ;
151- margin : 10px 0px 10px 10px ;
152- float : right ;
110+ border-radius : 50px ;
111+ margin-top : 12px ;
112+ margin-left : 20px ;
113+ margin-right : 10px ;
114+ float : left ;
115+ position : relative ;
116+ }
117+ .title {
118+ font-size : 18px ;
119+ font-weight : bold ;
120+ color : azure ;
121+ line-height : 64px ;
122+ }
123+ }
124+ .system-user {
125+ text-align : right ;
126+ margin-right : 5px ;
127+ .userinfo-inner {
128+ cursor : pointer ;
129+ color : #fff ;
130+ img {
131+ width : 40px ;
132+ height : 40px ;
133+ border-radius : 20px ;
134+ margin : 10px 0px 10px 10px ;
135+ float : right ;
136+ }
153137 }
154138 }
155139 }
156- }
157-
158- .layout-footer {
159- background-color : #fafafa ;
160- text-align : center ;
161- font-size : 15px ;
162- height : 50px ;
163- line-height : 50px ;
164- width : 100% ;
165- a {
166- color : #303133 ;
167- font-weight : 400 ;
140+ .layout-footer {
141+ background-color : #fafafa ;
142+ height : 50px ;
143+ text-align : center ;
144+ font-size : 15px ;
145+ line-height : 50px ;
146+ bottom : 0 ;
147+ a {
148+ color : #303133 ;
149+ font-weight : 400 ;
150+ }
151+ }
152+ .layout-main {
153+ background-color : #fafafa ;
154+ top : 64px ;
155+ bottom : 50px ;
156+ height : auto ;
168157 }
169- }
170-
171- .layout-main {
172- width : 100% ;
173- background-color : #fafafa ;
174- // position: relative;
175- // overflow: scroll;
176- // overflow-x: hidden;
177158}
178159 </style >
0 commit comments