File tree Expand file tree Collapse file tree 2 files changed +42
-8
lines changed Expand file tree Collapse file tree 2 files changed +42
-8
lines changed Original file line number Diff line number Diff line change 96
96
<el-input v-model =" variableSearchText" placeholder =" 搜索变量" clearable :prefix-icon =" Search" />
97
97
</div >
98
98
<div class =" variables" ref =" variablesRef" >
99
- <el-scrollbar >
99
+ <el-scrollbar always >
100
100
<button v-for =" variable in filteredVariables" :key =" variable.code" @click =" addVariable(variable)"
101
101
:title =" variable.name" >
102
102
{{ variable.name }}
Original file line number Diff line number Diff line change 29
29
padding-right : v .$spacing-xl ; // 增加右侧内边距
30
30
border-right : 1px solid var (--el-border-color-light ); // 添加分隔线
31
31
flex : 1 ;
32
+ display : flex ;
33
+ flex-direction : column ;
32
34
33
35
.variables {
34
36
:deep (.el-scrollbar ) {
50
52
display : flex ;
51
53
flex-direction : column ;
52
54
gap : v .$spacing-xs ;
53
- max- height : 320px ;
55
+ height : 320px ; // 固定高度
54
56
margin : 0 auto ;
55
57
overflow : hidden ;
56
58
transition : all 0.3s ease ;
66
68
}
67
69
68
70
.variables-search {
71
+ flex-shrink : 0 ; // 防止搜索框被压缩
69
72
padding : 0 12px ;
73
+ margin-bottom : v .$spacing-xs ;
70
74
71
75
:deep (.el-input ) {
72
76
.el- input__wrapper {
79
83
80
84
.variables {
81
85
flex : 1 ;
86
+ min-height : 0 ; // 允许元素在flex布局中收缩
87
+ position : relative ;
82
88
overflow : hidden ;
89
+ max-height : calc (100% - 50px ); // 减去搜索框的高度和间距
83
90
padding-right : v .$spacing-md ; // 减小右侧padding,因为scrollbar已经占据了一定空间
91
+ display : flex ; // 添加 flex 布局
92
+ flex-direction : column ; // 垂直方向布局
84
93
85
94
:deep (.el-scrollbar ) {
86
- height : 100% ;
87
- max-height : 400px ;
95
+ height : 100% ; // 确保高度占满容器
96
+ min-height : 0 ; // 允许内容区域收缩
97
+
98
+ .el-scrollbar__wrap {
99
+ overflow-x : hidden ;
100
+ }
88
101
89
- @media (max-width : 768px ) {
90
- max-height : 300px ;
102
+ .el-scrollbar__view {
103
+ padding : v .$spacing-md ;
104
+ display : flex ;
105
+ flex-direction : column ;
106
+ gap : v .$spacing-xs ;
91
107
}
92
108
}
93
109
94
- :deep(.el-scrollbar__wrap ) {
95
- padding : v .$spacing-md v .$spacing-md v .$spacing-md v .$spacing-md ; // 增加滚动区域的内边距
110
+ button {
111
+ flex-shrink : 0 ;
112
+ width : 100% ;
113
+ text-align : left ;
114
+ padding : 8px 12px ;
115
+ border : 1px solid var (--el-border-color-lighter );
116
+ border-radius : 4px ;
117
+ background : var (--el-bg-color );
118
+ color : var (--el-text-color-regular );
119
+ transition : all 0.3s ;
120
+ cursor : pointer ;
121
+ white-space : nowrap ;
122
+ overflow : hidden ;
123
+ text-overflow : ellipsis ;
124
+
125
+ & :hover {
126
+ border-color : var (--el-color-primary );
127
+ color : var (--el-color-primary );
128
+ background : var (--el-color-primary-light-9 );
129
+ }
96
130
}
97
131
}
98
132
You can’t perform that action at this time.
0 commit comments