File tree 6 files changed +70
-27
lines changed
6 files changed +70
-27
lines changed Original file line number Diff line number Diff line change 4
4
@option-prefix-cls : ~ " @{pure-prefix} -option" ;
5
5
6
6
.@{option-prefix-cls} {
7
- padding : 6 px 10 px ;
7
+ display : flex ;
8
8
overflow : hidden ;
9
9
10
+ & :not (:first-child ) {
11
+ .@{option-prefix-cls} __content {
12
+ border-top : solid 1px #f2f2f2 ;
13
+ }
14
+ }
15
+
10
16
& :hover {
11
- background-color : fade ( @primary-color , 5 % ) ;
17
+ background-color : #f9f9f9 ;
12
18
}
13
19
14
- &- -checked {
20
+ & .is -checked {
15
21
position : relative ;
16
- background-color : fade (@primary-color ,5 % );
22
+ background-color : fade (@primary-color ,6 % );
17
23
color : @primary-color ;
18
24
19
- & ::after {
20
- font-family : ' pureicon' ;
21
- font-style : normal ;
22
- -webkit-font-smoothing : antialiased ;
23
- -moz-osx-font-smoothing : grayscale ;
24
- display : block ;
25
- content : ' \e63f ' ;
26
- position : absolute ;
27
- right : 10px ;
28
- top : 50% ;
29
- transform : translate3d (0 ,-50% ,0 );
30
- color : @primary-color ;
31
- font-size : 13px ;
32
- }
33
-
34
25
& :hover {
35
26
background-color : fade (@primary-color ,10% );
36
27
}
37
28
}
29
+
30
+ &__icon {
31
+ padding : 8px 4px ;
32
+ font-size : 13px ;
33
+ color : @primary-color ;
34
+ width : 20px ;
35
+ text-align : center ;
36
+ }
37
+
38
+ &__content {
39
+ flex : 1 ;
40
+ padding : 8px 10px 8px 0 ;
41
+ font-size : 13px ;
42
+ }
38
43
}
Original file line number Diff line number Diff line change 42
42
margin-top : 5px ;
43
43
padding : 5px 0 ;
44
44
background-color : #fff ;
45
- border : solid 1px #ddd ;
46
- box-shadow : 1px 1px 6px 1px rgba (0 ,0 ,0 ,.1 );
45
+ border : solid 1px #f2f2f2 ;
46
+ box-shadow : 1px 1px 6px 1px rgba (0 ,0 ,0 ,.03 );
47
47
z-index : 1 ;
48
+ opacity : 0 ;
49
+ transform : translate3d (0 ,-20px ,0 ) scale (.9 );
50
+ transition : all .16s ease ;
51
+
52
+ & .is-transition-fadeup {
53
+ opacity : 1 ;
54
+ transform : translate3d (0 ,0 ,0 ) scale (1 );
55
+ }
48
56
}
49
57
50
58
.@{input-prefix-cls} __wrapper {
Original file line number Diff line number Diff line change 10
10
"license" : " MIT" ,
11
11
"devDependencies" : {
12
12
"pure-cli" : " latest"
13
+ },
14
+ "dependencies" : {
15
+ "@pure/icon" : " ^0.1.0"
13
16
}
14
17
}
Original file line number Diff line number Diff line change 1
1
<template>
2
- <div class="pure-option { checked ? 'pure-option--checked' : '' }" ref="option" on-click="{ this.onClick() }">
3
- {#inc this.$body}
2
+ <div
3
+ class="pure-option { checked ? 'is-checked' : '' }"
4
+ ref="option"
5
+ on-click="{ this.onCheck() }"
6
+ >
7
+ <div class="pure-option__icon">
8
+ {#if checked}
9
+ <Icon type="right"></Icon>
10
+ {/if}
11
+ </div>
12
+ <div class="pure-option__content">
13
+ {#inc this.$body}
14
+ </div>
4
15
</div>
5
16
</template>
6
17
7
18
<script>
19
+ import Icon from '@pure/icon';
20
+
8
21
export default {
22
+ components: {
23
+ Icon,
24
+ },
9
25
config() {
10
26
this.data.checked = false;
11
27
12
28
if ( this.$outer && this.$outer.optionPing ) {
13
29
this.$outer.optionPing( this );
14
30
}
15
31
},
16
- onClick () {
32
+ onCheck () {
17
33
if ( this.$outer && this.$outer.onOptionChange ) {
18
34
this.$outer.onOptionChange( this );
19
35
}
Original file line number Diff line number Diff line change 3
3
<Input placeholder="{ placeholder || 'Choose' }" value="{ text }" readonly sm="{ sm }" transparent="{ transparent }" on-click="{ this.onToggleOptions() }"></Input>
4
4
5
5
<div class="pure-select__icon" style="{ show ? 'display: block;' : '' }">
6
- <Icon> </Icon>
6
+ <Icon type="down2"> </Icon>
7
7
</div>
8
8
9
- <div class="pure-select__options" r-hide="{ !show }">
9
+ {#if show}
10
+ <div
11
+ class="pure-select__options"
12
+ r-animation="on: enter;class: is-transition-fadeup,3;"
13
+ r-animation="on: leave;class: is-transition-fadeup,4;"
14
+ >
10
15
{#inc this.$body}
11
16
</div>
17
+ {/if}
12
18
</div>
13
19
</template>
14
20
44
50
},
45
51
optionPing( target ) {
46
52
this.children.push( target );
53
+ if ( this.data.selected === target.data.value ) {
54
+ target.data.checked = true;
55
+ } else {
56
+ target.data.checked = false;
57
+ }
47
58
},
48
59
onOptionChange( target ) {
49
60
this.data.show = false;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import Option from '@pure/option';
4
4
play ( Select , module ) . name ( 'Select' ) . component ( 'Option' , Option ) . add (
5
5
'basic' ,
6
6
`
7
- <Select selected="0" >
7
+ <Select>
8
8
<Option value="0">Option 0</Option>
9
9
<Option value="1">Option 1</Option>
10
10
<Option value="2">Option 2</Option>
You can’t perform that action at this time.
0 commit comments