comand-component-library 3.3.37 → 3.3.39
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -17,7 +17,7 @@ export default {
|
|
17
17
|
data() {
|
18
18
|
return {
|
19
19
|
windowInnerHeight: window.innerHeight,
|
20
|
-
windowScrollY: window.scrollY,
|
20
|
+
windowScrollY: window.scrollY ?? (document.querySelector(this.parentSelector)?.scrollTop || 0),
|
21
21
|
scrollHeight: document.querySelector(this.parentSelector)?.scrollHeight || 0
|
22
22
|
}
|
23
23
|
},
|
@@ -44,11 +44,11 @@ export default {
|
|
44
44
|
},
|
45
45
|
created() {
|
46
46
|
window.addEventListener('resize', this.onViewportChange)
|
47
|
-
|
47
|
+
document.querySelector(this.parentSelector)?.addEventListener('scroll', this.onViewportChange)
|
48
48
|
},
|
49
49
|
unmounted() {
|
50
50
|
window.removeEventListener('resize', this.onViewportChange)
|
51
|
-
|
51
|
+
document.querySelector(this.parentSelector)?.removeEventListener('scroll', this.onViewportChange)
|
52
52
|
},
|
53
53
|
/* watch for changes */
|
54
54
|
computed: {
|
@@ -59,11 +59,11 @@ export default {
|
|
59
59
|
methods: {
|
60
60
|
onViewportChange() {
|
61
61
|
this.windowInnerHeight = window.innerHeight;
|
62
|
-
this.windowScrollY = window.scrollY
|
62
|
+
this.windowScrollY = window.scrollY ?? (document.querySelector(this.parentSelector)?.scrollTop || 0)
|
63
63
|
this.scrollHeight = document.querySelector(this.parentSelector)?.scrollHeight || 0
|
64
64
|
},
|
65
65
|
onBackToTop() {
|
66
|
-
|
66
|
+
document.querySelector(this.parentSelector)?.scrollTo({top: 0, left: 0, behavior: 'smooth'})
|
67
67
|
}
|
68
68
|
}
|
69
69
|
}
|