1 | $main: #30b386;
|
2 | $border: #c2ccdc;
|
3 | $font: #666;
|
4 | $placeholder: #aaa;
|
5 | $select: #fff;
|
6 | $input-bg: #fff;
|
7 | $input-bg-disabled: #f9f9f9;
|
8 | $base-size: 10px;
|
9 | $option-hover-bg: lighten($main, 50%);
|
10 | $shadow: rgba(0, 0, 0, 0.1);
|
11 | $multi-value-color: #eee;
|
12 |
|
13 | @function size($factor) {
|
14 | @return $factor * $base-size;
|
15 | }
|
16 |
|
17 | $option-height: size(3);
|
18 | $multi-value-height: size(2.4);
|
19 | $scrollbar-wrap-min-width: size(16);
|
20 | $option-padding: size(0.4);
|
21 |
|
22 | @mixin placeholder($color: $placeholder) {
|
23 | &::-webkit-input-placeholder {
|
24 | /* WebKit browsers */
|
25 | color: $color;
|
26 | }
|
27 |
|
28 | &:-moz-placeholder {
|
29 | /* Mozilla Firefox 4 to 18 */
|
30 | color: $color;
|
31 | }
|
32 |
|
33 | &::-moz-placeholder {
|
34 | /* Mozilla Firefox 19+ */
|
35 | color: $color;
|
36 | }
|
37 |
|
38 | &:-ms-input-placeholder {
|
39 | /* Internet Explorer 10+ */
|
40 | color: $color;
|
41 | }
|
42 | }
|
43 |
|
44 | @mixin middleLine($color) {
|
45 | content: '';
|
46 | position: absolute;
|
47 | left: 0;
|
48 | right: 0;
|
49 | top: 50%;
|
50 | height: 1px;
|
51 | background: $color;
|
52 | }
|
53 |
|
54 | @mixin dot($color) {
|
55 | content: '';
|
56 | position: absolute;
|
57 | left: 50%;
|
58 | top: 50%;
|
59 | width: size(0.6);
|
60 | height: size(0.6);
|
61 | margin: size(-0.3) 0 0 size(-0.3);
|
62 | border-radius: size(0.3);
|
63 | background: $color;
|
64 | }
|
65 |
|
66 |
|
67 | .scrollbar-wrap .scrollbar {
|
68 | width: size(0.4) !important;
|
69 | border-radius: size(0.6) !important;
|
70 | background: #eee !important;
|
71 | }
|
72 |
|
73 |
|
74 | $bg: $input-bg;
|
75 | $pseudoSize: size(0.6);
|
76 |
|
77 | @mixin pseudo($bg: $border, $direction: top, $borderWidth: $pseudoSize) {
|
78 | position: absolute;
|
79 | #{$direction}: -$pseudoSize;
|
80 | width: 0;
|
81 | height: 0;
|
82 | border: $borderWidth solid transparent;
|
83 |
|
84 | @if ($direction==top) {
|
85 | border-top: 0;
|
86 | border-bottom-color: $bg;
|
87 | } @else if ($direction==bottom) {
|
88 | border-bottom: 0;
|
89 | border-top-color: $bg;
|
90 | } @else if ($direction==left) {
|
91 | border-left: 0;
|
92 | border-right-color: $bg;
|
93 | } @else if ($direction==right) {
|
94 | border-right: 0;
|
95 | border-left-color: $bg;
|
96 | }
|
97 | }
|
98 |
|
99 | .vue-popper {
|
100 | border-color: rgba($border, 0.5) !important;
|
101 |
|
102 | &[x-placement^='bottom'] .arrow {
|
103 | border-bottom-color: rgba($border, 0.5) !important;
|
104 | }
|
105 | &[x-placement^='top'] .arrow {
|
106 | border-top-color: rgba($border, 0.5) !important;
|
107 | }
|
108 | }
|
109 |
|
110 | .split {
|
111 | color: $placeholder !important;
|
112 | }
|
113 |
|
114 | .select-base,
|
115 | .select-multi,
|
116 | .cascader,
|
117 | .cascader-multi {
|
118 | position: relative;
|
119 | padding: 0 size(1);
|
120 | font-size: size(1.4);
|
121 | color: $font;
|
122 | border: 1px solid $border;
|
123 | border-radius: size(0.3);
|
124 | background: transparent;
|
125 | cursor: pointer;
|
126 |
|
127 | * {
|
128 | box-sizing: border-box;
|
129 | outline: none !important;
|
130 | }
|
131 |
|
132 | .input {
|
133 | cursor: pointer;
|
134 | }
|
135 |
|
136 | &.disabled {
|
137 | background: $input-bg-disabled;
|
138 | cursor: default;
|
139 | }
|
140 |
|
141 | &.select-multi,
|
142 | &.cascader,
|
143 | &.cascader-multi {
|
144 | .options .option {
|
145 | &.selected {
|
146 | color: $main !important;
|
147 | background: transparent !important;
|
148 | font-weight: 600;
|
149 |
|
150 | .icon-selected {
|
151 | float: right;
|
152 | position: relative;
|
153 | width: $option-height/2;
|
154 | height: 100%;
|
155 |
|
156 | &:before {
|
157 | @include dot($main);
|
158 | }
|
159 | }
|
160 |
|
161 | .icon-expand:before {
|
162 | border-left-color: $main;
|
163 | }
|
164 | }
|
165 |
|
166 | &:hover {
|
167 | background: $option-hover-bg !important;
|
168 |
|
169 | .icon-expand:after {
|
170 | border-left-color: $option-hover-bg;
|
171 | }
|
172 | }
|
173 |
|
174 | .icon-expand {
|
175 | display: block;
|
176 | float: right;
|
177 | position: relative;
|
178 | top: calc((#{$option-height} - #{size(1)}) / 2);
|
179 | width: size(1);
|
180 | height: size(1);
|
181 |
|
182 | &:before {
|
183 | content: '';
|
184 | @include pseudo($font, right, size(0.5));
|
185 | right: 0;
|
186 | }
|
187 |
|
188 | &:after {
|
189 | content: '';
|
190 | @include pseudo($input-bg, right, size(0.5));
|
191 | right: 1px;
|
192 | }
|
193 | }
|
194 | }
|
195 | }
|
196 |
|
197 | &.cascader,
|
198 | &.cascader-multi {
|
199 | .options {
|
200 | display: -webkit-box;
|
201 | display: -webkit-flex;
|
202 | display: -ms-flexbox;
|
203 | display: flex;
|
204 | right: auto;
|
205 | width: auto;
|
206 |
|
207 | .scrollbar-wrap {
|
208 | width: auto;
|
209 | min-width: $scrollbar-wrap-min-width;
|
210 | }
|
211 |
|
212 | .option {
|
213 | &.selected {
|
214 | font-weight: 500;
|
215 | }
|
216 | }
|
217 |
|
218 | .line {
|
219 | float: left;
|
220 | width: 1px;
|
221 | margin: -$option-padding 0;
|
222 | background: rgba($border, 0.5);
|
223 | }
|
224 | }
|
225 | }
|
226 |
|
227 | .value,
|
228 | .input {
|
229 | width: 100%;
|
230 | height: $option-height;
|
231 | line-height: $option-height;
|
232 | margin: 0;
|
233 | padding: 0;
|
234 | border: none;
|
235 | }
|
236 |
|
237 | .placeholder {
|
238 | color: $placeholder;
|
239 | }
|
240 |
|
241 | .input {
|
242 | display: block;
|
243 | outline: none !important;
|
244 |
|
245 | @include placeholder($placeholder);
|
246 | }
|
247 |
|
248 | .values {
|
249 | min-height: $option-height;
|
250 | height: auto;
|
251 | overflow: hidden;
|
252 | }
|
253 |
|
254 | .val {
|
255 | display: inline-block;
|
256 | width: auto;
|
257 | height: $multi-value-height;
|
258 | line-height: $multi-value-height;
|
259 | padding: 0 size(0.6);
|
260 | margin: ($option-height - $multi-value-height)/2;
|
261 | margin-left: 0;
|
262 | border-radius: size(0.2);
|
263 | background: $multi-value-color;
|
264 | white-space: nowrap;
|
265 | vertical-align: top;
|
266 |
|
267 | &.input,
|
268 | &.placeholder {
|
269 | background: transparent;
|
270 | }
|
271 |
|
272 | .v {
|
273 | float: left;
|
274 | font-size: size(1.2);
|
275 | }
|
276 |
|
277 | .icon-del {
|
278 | float: right;
|
279 | margin: 0 0 0 size(1);
|
280 | position: relative;
|
281 | width: $multi-value-height / 2;
|
282 | height: 100%;
|
283 |
|
284 | &:hover {
|
285 | &:before,
|
286 | &:after {
|
287 | background: darken($font, 20%);
|
288 | }
|
289 | }
|
290 |
|
291 | &:before,
|
292 | &:after {
|
293 | @include middleLine($font);
|
294 | transform: rotate(45deg);
|
295 | }
|
296 |
|
297 | &:after {
|
298 | transform: rotate(-45deg);
|
299 | }
|
300 | }
|
301 | }
|
302 |
|
303 | .icon-arrow {
|
304 | display: block;
|
305 | position: absolute;
|
306 | right: size(0.4);
|
307 | top: 50%;
|
308 | width: size(1);
|
309 | height: size(0.5);
|
310 | margin: size(-0.25) 0 0;
|
311 | transition: transform 0.3s ease;
|
312 |
|
313 | &:before {
|
314 | content: '';
|
315 | @include pseudo($font, bottom, size(0.5));
|
316 | bottom: 0;
|
317 | }
|
318 |
|
319 | &:after {
|
320 | content: '';
|
321 | @include pseudo($input-bg, bottom, size(0.5));
|
322 | bottom: 1px;
|
323 | }
|
324 |
|
325 | &.reverse {
|
326 | transform: rotate(180deg);
|
327 | }
|
328 | }
|
329 |
|
330 | .options {
|
331 | width: 100%;
|
332 | padding: $option-padding 0;
|
333 | z-index: 9999;
|
334 | box-shadow: 0 1px size(1) $shadow;
|
335 |
|
336 | .option {
|
337 | height: $option-height;
|
338 | line-height: $option-height;
|
339 | padding: 0 size(1);
|
340 |
|
341 | &:hover {
|
342 | background: $option-hover-bg !important;
|
343 | }
|
344 |
|
345 | &.selected {
|
346 | color: $select !important;
|
347 | background: $main !important;
|
348 | }
|
349 | }
|
350 | }
|
351 | }
|