comand-component-library 3.3.40 → 3.3.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/App.vue
CHANGED
@@ -819,7 +819,7 @@
|
|
819
819
|
<!-- end advanced form elements ----------------------------------------------------------------------------------------------------------------------------------------------------->
|
820
820
|
|
821
821
|
<!-- begin back to top button ----------------------------------------------------------------------------------------------------------------------------------------------------->
|
822
|
-
<CmdBackToTopButton/>
|
822
|
+
<CmdBackToTopButton />
|
823
823
|
<!-- end back to top button ----------------------------------------------------------------------------------------------------------------------------------------------------->
|
824
824
|
|
825
825
|
<!-- begin bank account data ----------------------------------------------------------------------------------------------------------------------------------------------------->
|
@@ -17,12 +17,12 @@ export default {
|
|
17
17
|
data() {
|
18
18
|
return {
|
19
19
|
windowInnerHeight: window.innerHeight,
|
20
|
-
windowScrollY:
|
21
|
-
scrollHeight: document.querySelector(this.
|
20
|
+
windowScrollY: this.getScrollY(),
|
21
|
+
scrollHeight: document.querySelector(this.scrollContainer)?.scrollHeight || 0
|
22
22
|
}
|
23
23
|
},
|
24
24
|
props: {
|
25
|
-
|
25
|
+
scrollContainer: {
|
26
26
|
type: String,
|
27
27
|
default: "body"
|
28
28
|
},
|
@@ -44,18 +44,18 @@ export default {
|
|
44
44
|
},
|
45
45
|
mounted() {
|
46
46
|
window.addEventListener('resize', this.onViewportChange)
|
47
|
-
if (this.
|
47
|
+
if (this.scrollContainer === "body") {
|
48
48
|
window.addEventListener('scroll', this.onViewportChange);
|
49
49
|
} else {
|
50
|
-
document.querySelector(this.
|
50
|
+
document.querySelector(this.scrollContainer)?.addEventListener('scroll', this.onViewportChange);
|
51
51
|
}
|
52
52
|
},
|
53
53
|
unmounted() {
|
54
54
|
window.removeEventListener('resize', this.onViewportChange)
|
55
|
-
if (this.
|
55
|
+
if (this.scrollContainer === "body") {
|
56
56
|
window.addEventListener('scroll', this.onViewportChange);
|
57
57
|
} else {
|
58
|
-
document.querySelector(this.
|
58
|
+
document.querySelector(this.scrollContainer)?.removeEventListener('scroll', this.onViewportChange)
|
59
59
|
}
|
60
60
|
},
|
61
61
|
/* watch for changes */
|
@@ -65,16 +65,22 @@ export default {
|
|
65
65
|
}
|
66
66
|
},
|
67
67
|
methods: {
|
68
|
+
getScrollY() {
|
69
|
+
if (this.scrollContainer === "body") {
|
70
|
+
return window.scrollY
|
71
|
+
}
|
72
|
+
return document.querySelector(this.scrollContainer)?.scrollTop || 0
|
73
|
+
},
|
68
74
|
onViewportChange() {
|
69
75
|
this.windowInnerHeight = window.innerHeight;
|
70
|
-
this.windowScrollY =
|
71
|
-
this.scrollHeight = document.querySelector(this.
|
76
|
+
this.windowScrollY = this.getScrollY()
|
77
|
+
this.scrollHeight = document.querySelector(this.scrollContainer)?.scrollHeight || 0
|
72
78
|
},
|
73
79
|
onBackToTop() {
|
74
|
-
if (this.
|
80
|
+
if (this.scrollContainer === "body") {
|
75
81
|
window.scrollTo({top: 0, left: 0, behavior: 'smooth'})
|
76
82
|
} else {
|
77
|
-
document.querySelector(this.
|
83
|
+
document.querySelector(this.scrollContainer)?.scrollTo({top: 0, left: 0, behavior: 'smooth'})
|
78
84
|
}
|
79
85
|
}
|
80
86
|
}
|