File tree Expand file tree Collapse file tree 1 file changed +25
-25
lines changed Expand file tree Collapse file tree 1 file changed +25
-25
lines changed Original file line number Diff line number Diff line change
1
+ const defaultGridProps = {
2
+ target : 'self' ,
3
+ url : '' ,
4
+ openType : 'navigate' ,
5
+ delta : 1 ,
6
+ appId : '' ,
7
+ path : '' ,
8
+ extraData : '' ,
9
+ version : 'release' ,
10
+ hoverClass : 'navigator-hover' ,
11
+ hoverStopPropagation : false ,
12
+ hoverStartTime : 50 ,
13
+ hoverStayTime : 600 ,
14
+ bindsuccess : ( ) => { } ,
15
+ bindfail : ( ) => { } ,
16
+ bindcomplete : ( ) => { }
17
+ }
18
+
1
19
Component ( {
2
20
options : {
3
21
addGlobalClass : true ,
@@ -10,37 +28,19 @@ Component({
10
28
} ,
11
29
grids : {
12
30
type : Array ,
13
- value : [ ]
31
+ value : [ ] ,
32
+ observer : '_onGridsChange'
14
33
}
15
34
} ,
16
35
data : {
17
- innerGrids : [ ] ,
18
- _defaultGridProps : {
19
- target : 'self' ,
20
- url : '' ,
21
- openType : 'navigate' ,
22
- delta : 1 ,
23
- appId : '' ,
24
- path : '' ,
25
- extraData : '' ,
26
- version : 'release' ,
27
- hoverClass : 'navigator-hover' ,
28
- hoverStopPropagation : false ,
29
- hoverStartTime : 50 ,
30
- hoverStayTime : 600 ,
31
- bindsuccess ( ) { } ,
32
- bindfail ( ) { } ,
33
- bindcomplete ( ) { }
34
- }
36
+ innerGrids : [ ]
35
37
} ,
36
38
ready ( ) { } ,
37
- lifetimes : {
38
- attached ( ) {
39
- if ( this . data . grids ) {
39
+ methods : {
40
+ _onGridsChange ( grids ) : void {
41
+ if ( grids ) {
40
42
this . setData ( {
41
- innerGrids : this . data . grids . map ( ( grid ) =>
42
- Object . assign ( { } , this . data . _defaultGridProps , grid )
43
- )
43
+ innerGrids : grids . map ( ( grid ) => Object . assign ( { } , defaultGridProps , grid ) )
44
44
} )
45
45
}
46
46
}
You can’t perform that action at this time.
0 commit comments