瀏覽代碼

移除不必要的代码,优化页面加载逻辑,禁止外层滚动

yuanmingze 1 月之前
父節點
當前提交
d371bec717
共有 1 個文件被更改,包括 1 次插入16 次删除
  1. 1 16
      src/views/register/index.vue

+ 1 - 16
src/views/register/index.vue

@@ -29,7 +29,7 @@
 </template>
 
 <script setup lang="ts">
-import { ref, onMounted, onUnmounted } from 'vue'
+import { ref, onMounted } from 'vue'
 import { useRouter } from 'vue-router'
 import { showFailToast } from 'vant'
 import { REGISTER_URL_KEY } from '@/constants/storage'
@@ -54,9 +54,6 @@ const onLoad = () => {
 }
 
 onMounted(() => {
-  // 禁止外层滚动,避免出现页面滚动条
-  document.body.style.overflow = 'hidden'
-
   if (props.src) {
     realSrc.value = props.src
     return
@@ -70,10 +67,6 @@ onMounted(() => {
     router.back()
   }
 })
-
-onUnmounted(() => {
-  document.body.style.overflow = ''
-})
 </script>
 
 <style lang="scss" scoped>
@@ -118,12 +111,4 @@ onUnmounted(() => {
     color: #999;
   }
 }
-
-/* 站点级兜底:去掉默认间距并禁掉页面滚动(scoped 下需 :global) */
-:global(html, body) {
-  margin: 0;
-  padding: 0;
-  overflow: hidden;
-  overscroll-behavior: none;
-}
 </style>