How do you click paging to get vue back to the top?

online search can use document.body.scrollTop, but I wrote a test in the project demo has no effect, why?

   
   
   <button @click="opt"></button>
   
    opt(){
       if(document.body.scrollTop){
         document.body.scrollTop = 0
       }else {
         document.documentElement.scrollTop = 0
       }
     },
Sep.07,2021

indicates that the scrolling container is not scrollTop of window or body, modified scrolling container


window.scrollTo (0L0)


is the demo of the subject in the autoScroll container? If so, no, otherwise the answer upstairs should be OK


print document.body.scrollTop if 0 means the scrolling container is not body, and see if there is a parent container overflow-y is auto | scroll , put its scrollTop=0

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b8d8-3466d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b8d8-3466d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?