File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -33,9 +33,18 @@ export default {
33
33
height: undefined ,
34
34
child: null ,
35
35
stickyHeight: 0
36
-
37
36
}
38
37
},
38
+ mounted () {
39
+ this .height = this .$el .getBoundingClientRect ().height
40
+ window .addEventListener (' scroll' , this .handleScroll )
41
+ },
42
+ activated () {
43
+ this .handleScroll ()
44
+ },
45
+ destroyed () {
46
+ window .removeEventListener (' scroll' , this .handleScroll )
47
+ },
39
48
methods: {
40
49
sticky () {
41
50
if (this .active ) {
@@ -62,13 +71,6 @@ export default {
62
71
}
63
72
this .reset ()
64
73
}
65
- },
66
- mounted () {
67
- this .height = this .$el .getBoundingClientRect ().height
68
- window .addEventListener (' scroll' , this .handleScroll )
69
- },
70
- destroyed () {
71
- window .removeEventListener (' scroll' , this .handleScroll )
72
74
}
73
75
}
74
76
</script >
You can’t perform that action at this time.
0 commit comments