Skip to content

Commit fc09870

Browse files
committed
style: Select controller refactor.
1 parent 5049979 commit fc09870

File tree

2 files changed

+21
-61
lines changed

2 files changed

+21
-61
lines changed

src/components/CheckController/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<template>
22
<!-- click.stop 避免向上冒泡触发 tree.vue 的 click 事件-->
3-
<label :class="[`vjs-${uiType}`, checked ? 'is-checked' : '']" @click.stop>
4-
<span :class="`vjs-${uiType}__inner`" />
3+
<label :class="[`vjs-check-controller`, checked ? 'is-checked' : '']" @click.stop>
4+
<span :class="`vjs-check-controller__inner is-${uiType}`" />
55
<input
66
v-model="model"
7-
:class="`vjs-${uiType}__original`"
7+
:class="`vjs-check-controller__original is-${uiType}`"
88
:type="uiType"
99
@change="$emit('change', model)"
1010
@focus="focus = true"

src/components/CheckController/styles.less

Lines changed: 18 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
@import '~src/themes.less';
22

3-
.@{css-prefix}-checkbox {
3+
.@{css-prefix}-check-controller {
44
position: absolute;
55
left: 0;
6-
color: #1f2d3d;
7-
user-select: none;
86

9-
&.is-checked .@{css-prefix}-checkbox__inner {
7+
&.is-checked .@{css-prefix}-check-controller__inner {
108
background-color: @color-primary;
119
border-color: darken(@color-primary, 10%);
1210

13-
&:after {
11+
&.is-checkbox:after {
1412
transform: rotate(45deg) scaleY(1);
1513
}
14+
15+
&.is-radio:after {
16+
transform: translate(-50%, -50%) scale(1);
17+
}
1618
}
1719

18-
.@{css-prefix}-checkbox__inner {
20+
.@{css-prefix}-check-controller__inner {
1921
display: inline-block;
2022
position: relative;
2123
border: 1px solid @border-color;
@@ -45,63 +47,21 @@
4547
transition: transform 0.15s cubic-bezier(0.71, -0.46, 0.88, 0.6) 0.05s;
4648
transform-origin: center;
4749
}
48-
}
49-
50-
.@{css-prefix}-checkbox__original {
51-
opacity: 0;
52-
outline: none;
53-
position: absolute;
54-
z-index: -1;
55-
top: 0;
56-
left: 0;
57-
right: 0;
58-
bottom: 0;
59-
margin: 0;
60-
}
61-
}
6250

63-
.@{css-prefix}-radio {
64-
position: absolute;
65-
left: 0;
66-
color: #1f2d3d;
67-
user-select: none;
68-
69-
&.is-checked .@{css-prefix}-radio__inner {
70-
background-color: @color-primary;
71-
border-color: darken(@color-primary, 10%);
72-
73-
&:after {
74-
transform: translate(-50%, -50%) scale(1);
75-
}
76-
}
77-
78-
.@{css-prefix}-radio__inner {
79-
border: 1px solid @border-color;
80-
border-radius: 100%;
81-
width: 16px;
82-
height: 16px;
83-
vertical-align: middle;
84-
background-color: #fff;
85-
position: relative;
86-
cursor: pointer;
87-
display: inline-block;
88-
box-sizing: border-box;
89-
90-
&:after {
91-
width: 4px;
92-
height: 4px;
51+
&.is-radio {
9352
border-radius: 100%;
94-
background-color: #fff;
95-
content: '';
96-
position: absolute;
97-
left: 50%;
98-
top: 50%;
99-
transform: translate(-50%, -50%) scale(0);
100-
transition: transform 0.15s ease-in;
53+
54+
&:after {
55+
border-radius: 100%;
56+
height: 4px;
57+
background-color: #fff;
58+
left: 50%;
59+
top: 50%;
60+
}
10161
}
10262
}
10363

104-
.@{css-prefix}-radio__original {
64+
.@{css-prefix}-check-controller__original {
10565
opacity: 0;
10666
outline: none;
10767
position: absolute;

0 commit comments

Comments
 (0)