@@ -17,20 +17,43 @@ export default Component.extend({
17
17
searchSvc : service ( 'search' ) ,
18
18
results : A ( [ ] ) ,
19
19
validSearch : true ,
20
+ keywords : '' ,
21
+ matchFilter : null ,
20
22
21
- init ( ) {
23
+ // init() {
24
+ // this._super(...arguments);
25
+ // },
26
+
27
+ didReceiveAttrs ( ) {
28
+ this . _super ( ...arguments ) ;
29
+ this . set ( 'keywords' , this . get ( 'filter' ) ) ;
30
+ this . set ( 'matchFilter' , this . get ( 'matchFilter' ) ) ;
31
+ this . fetch ( ) ;
32
+ console . log ( 'receive a' ) ;
33
+ } ,
34
+
35
+ didReceiveAttrs ( ) {
22
36
this . _super ( ...arguments ) ;
37
+ // this.set('keywords', this.get('filter'));
38
+ this . set ( 'matchFilter' , this . get ( 'matchFilter' ) ) ;
23
39
this . fetch ( ) ;
40
+ console . log ( 'update a' ) ;
24
41
} ,
25
42
43
+ // didUpdateAttrs() {
44
+ // this._super(...arguments);
45
+ // this.fetch();
46
+ // console.log('update a');
47
+ // },
48
+
26
49
fetch ( ) {
27
50
let payload = {
28
- keywords : this . get ( 'filter ' ) ,
29
- doc : this . get ( 'matchDoc' ) ,
30
- attachment : this . get ( 'matchFile' ) ,
31
- tag : this . get ( 'matchTag' ) ,
32
- content : this . get ( 'matchContent' ) ,
33
- slog : this . get ( 'slog' )
51
+ keywords : this . get ( 'keywords ' ) ,
52
+ doc : this . get ( 'matchFilter. matchDoc' ) ,
53
+ attachment : this . get ( 'matchFilter. matchFile' ) ,
54
+ tag : this . get ( 'matchFilter. matchTag' ) ,
55
+ content : this . get ( 'matchFilter. matchContent' ) ,
56
+ slog : this . get ( 'matchFilter. slog' )
34
57
} ;
35
58
36
59
payload . keywords = payload . keywords . trim ( ) ;
@@ -51,7 +74,7 @@ export default Component.extend({
51
74
52
75
actions : {
53
76
onSearch ( ) {
54
- if ( this . get ( 'filter ' ) . trim ( ) . length < 3 ) {
77
+ if ( this . get ( 'keywords ' ) . trim ( ) . length < 3 ) {
55
78
this . set ( 'validSearch' , false ) ;
56
79
return ;
57
80
}
0 commit comments