Ver código fonte

在视频播放器中添加页面滚动到顶部的功能,提升用户体验。

wuyi 2 meses atrás
pai
commit
1455b805e6
1 arquivos alterados com 6 adições e 0 exclusões
  1. 6 0
      src/views/VideoPlayer.vue

+ 6 - 0
src/views/VideoPlayer.vue

@@ -854,6 +854,12 @@ const playVideo = (video: any) => {
       params: { id: video.id },
     });
   }
+
+  // 滚动到页面顶端
+  window.scrollTo({
+    top: 0,
+    behavior: "smooth",
+  });
 };
 
 // 开始试看