fix back to top
This commit is contained in:
parent
77cd8fddfd
commit
8c0c7bad57
@ -237,12 +237,17 @@ const handlePageSizeChange = (size) => {
|
||||
|
||||
// 回到顶部
|
||||
const scrollToTop = () => {
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
// 尝试多种方法
|
||||
// 1. 使用document.body
|
||||
document.body.scrollTop = 0;
|
||||
// 2. 使用document.documentElement (HTML元素)
|
||||
document.documentElement.scrollTop = 0;
|
||||
// 3. 使用scrollIntoView
|
||||
document.querySelector(".historic-data-container").scrollIntoView({
|
||||
behavior: "smooth",
|
||||
block: "start",
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getPageDefaultData();
|
||||
});
|
||||
|
@ -236,12 +236,17 @@ const handlePageSizeChange = (size) => {
|
||||
|
||||
// 回到顶部
|
||||
const scrollToTop = () => {
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
// 尝试多种方法
|
||||
// 1. 使用document.body
|
||||
document.body.scrollTop = 0;
|
||||
// 2. 使用document.documentElement (HTML元素)
|
||||
document.documentElement.scrollTop = 0;
|
||||
// 3. 使用scrollIntoView
|
||||
document.querySelector(".historic-data-container").scrollIntoView({
|
||||
behavior: "smooth",
|
||||
block: "start",
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getPageDefaultData();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user