Skip to content

Commit 68896bc

Browse files
committed
优化布局样式:1. 为竖直布局设置固定高度和自适应宽度;2. 改进变量区域的弹性布局,确保内容正确显示;3. 调整滚动条样式,优化内边距设置。
1 parent 78c35b6 commit 68896bc

File tree

1 file changed

+57
-12
lines changed

1 file changed

+57
-12
lines changed

src/components/styles/layout.scss

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,45 @@
1414

1515
&:not(.horizontal-layout) {
1616
.variables-section {
17-
// 竖直布局时使用自适应高度
18-
height: auto;
19-
min-height: 120px; // 设置最小高度
20-
max-height: 320px; // 设置最大高度
17+
width: 100%;
18+
max-width: 320px;
19+
display: flex;
20+
flex-direction: column;
21+
height: 320px; // 设置固定高度
22+
min-height: 120px;
2123
margin-bottom: v.$spacing-md; // 添加底部间距
24+
25+
.variables-search {
26+
flex: 0 0 auto; // 搜索框固定高度
27+
height: 48px;
28+
}
29+
30+
.variables {
31+
flex: 1 1 auto; // 让变量区域自动填充剩余空间
32+
min-height: 0; // 关键:允许flex子项在需要时收缩
33+
position: relative;
34+
overflow: hidden;
35+
display: flex;
36+
flex-direction: column;
37+
38+
:deep(.el-scrollbar) {
39+
height: 100%;
40+
position: absolute;
41+
inset: 0;
42+
43+
.el-scrollbar__wrap {
44+
height: 100%;
45+
overflow-x: hidden;
46+
}
47+
48+
.el-scrollbar__view {
49+
padding: v.$spacing-md;
50+
display: flex;
51+
flex-direction: column;
52+
gap: v.$spacing-xs;
53+
}
54+
}
55+
}
2256
}
2357

2458
:deep(.calculator) {
@@ -102,22 +136,33 @@
102136
padding-right: v.$spacing-xs; // 添加右侧内边距
103137
transition: all 0.3s ease;
104138

105-
@media (max-width: 768px) {
139+
.variables-search {
140+
flex: 0 0 auto;
141+
height: 48px;
106142
width: 100%;
107-
max-width: 320px;
108143
}
109144

110145
.variables {
146+
flex: 1 1 auto;
147+
min-height: 0; // 允许内容收缩
111148
position: relative;
112-
flex: 1;
113149
overflow: hidden;
114-
display: flex;
115-
flex-direction: column;
116150

117151
:deep(.el-scrollbar) {
118-
min-height: 80px; // 设置最小高度
119-
height: auto; // 自适应高度
120-
max-height: calc(100% - 48px); // 减去搜索框高度
152+
position: absolute;
153+
inset: 0;
154+
height: 100%;
155+
156+
.el-scrollbar__wrap {
157+
height: 100%;
158+
}
159+
160+
.el-scrollbar__view {
161+
padding: v.$spacing-md;
162+
display: flex;
163+
flex-direction: column;
164+
gap: v.$spacing-xs;
165+
}
121166
}
122167
}
123168
}

0 commit comments

Comments
 (0)