fix back to top
This commit is contained in:
parent
77cd8fddfd
commit
8c0c7bad57
@ -237,12 +237,17 @@ const handlePageSizeChange = (size) => {
|
|||||||
|
|
||||||
// 回到顶部
|
// 回到顶部
|
||||||
const scrollToTop = () => {
|
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",
|
behavior: "smooth",
|
||||||
|
block: "start",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getPageDefaultData();
|
getPageDefaultData();
|
||||||
});
|
});
|
||||||
|
@ -236,12 +236,17 @@ const handlePageSizeChange = (size) => {
|
|||||||
|
|
||||||
// 回到顶部
|
// 回到顶部
|
||||||
const scrollToTop = () => {
|
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",
|
behavior: "smooth",
|
||||||
|
block: "start",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getPageDefaultData();
|
getPageDefaultData();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user