From a3716f72066d25d745f4d5103ff23a553c3e102b Mon Sep 17 00:00:00 2001 From: wayne <wayne8692wayne8692@gmail.com> Date: 星期四, 17 二月 2022 11:41:19 +0800 Subject: [PATCH] Merge branch 'sit' into uat --- PAMapp/components/Ui/UiGoToTop.vue | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/PAMapp/components/Ui/UiGoToTop.vue b/PAMapp/components/Ui/UiGoToTop.vue index 2fe1bd7..8ceb2f7 100644 --- a/PAMapp/components/Ui/UiGoToTop.vue +++ b/PAMapp/components/Ui/UiGoToTop.vue @@ -16,11 +16,19 @@ export default class UiGoToTop extends Vue { buttonDisplay = 'none'; + ////////////////////////////////////////////////////////////////// + created() { if (process.browser) { document.body.addEventListener('scroll', this.scrollFunction); } } + + destroyed() { + document.body.removeEventListener('scroll', this.scrollFunction); + } + + ////////////////////////////////////////////////////////////////// scrollFunction() { if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 300) { @@ -33,10 +41,6 @@ topFunction() { document.body.scrollTop = 0; document.documentElement.scrollTop = 0; - } - - destroyed() { - document.body.removeEventListener('scroll', this.scrollFunction); } } </script> @@ -66,4 +70,4 @@ background-color: $MID_GREY; } } -</style> \ No newline at end of file +</style> -- Gitblit v1.8.0