1
1
import hover from '../behaviors/hover' ;
2
+ import eventUtil from '../core/utils/event-util' ;
2
3
3
4
Component ( {
4
5
behaviors : [ hover ] ,
@@ -39,9 +40,12 @@ Component({
39
40
} ,
40
41
41
42
observers : {
43
+ 'result' : function ( count ) {
44
+ eventUtil . emit ( this , 'linchange' , { count } ) ;
45
+ } ,
42
46
'count,min,max' : function ( ) {
43
47
this . valueRange ( this . data . count , 'parameter' ) ;
44
- }
48
+ } ,
45
49
} ,
46
50
47
51
/**
@@ -50,10 +54,7 @@ Component({
50
54
methods : {
51
55
doNothing ( e ) {
52
56
const { type } = e . currentTarget . dataset ;
53
- this . triggerEvent ( 'linout' , { type, way : 'icon' } , {
54
- bubbles : true ,
55
- composed : true
56
- } ) ;
57
+ eventUtil . emit ( this , 'linout' , { type, way : 'icon' } ) ;
57
58
} ,
58
59
59
60
onCount ( ) {
@@ -72,13 +73,7 @@ Component({
72
73
setTimeout ( ( ) => {
73
74
this . blurCount ( Number ( value ) , ( ) => {
74
75
this . data . count = this . data . result ;
75
- this . triggerEvent ( 'lintap' , {
76
- count : this . data . result ,
77
- type : 'blur'
78
- } , {
79
- bubbles : true ,
80
- composed : true
81
- } ) ;
76
+ eventUtil . emit ( this , 'lintap' , { count : this . data . result , type : 'blur' } ) ;
82
77
} ) ;
83
78
} , 50 ) ;
84
79
} ,
@@ -99,19 +94,13 @@ Component({
99
94
this . setData ( {
100
95
result : this . properties . max
101
96
} , ( ) => {
102
- this . triggerEvent ( 'linout' , { type : 'overflow_max' , way } , {
103
- bubbles : true ,
104
- composed : true
105
- } ) ;
97
+ eventUtil . emit ( this , 'linout' , { type : 'overflow_max' , way } ) ;
106
98
} ) ;
107
99
} else if ( value < this . properties . min ) {
108
100
this . setData ( {
109
101
result : this . properties . min
110
102
} , ( ) => {
111
- this . triggerEvent ( 'linout' , { type : 'overflow_min' , way } , {
112
- bubbles : true ,
113
- composed : true
114
- } ) ;
103
+ eventUtil . emit ( this , 'linout' , { type : 'overflow_min' , way } ) ;
115
104
} ) ;
116
105
} else {
117
106
this . setData ( {
@@ -158,4 +147,4 @@ Component({
158
147
} ) ;
159
148
} ,
160
149
}
161
- } ) ;
150
+ } ) ;
0 commit comments