How does the paging component of vue+elemrnt ui return to the top of the table when turning pages?

how does the paging component of vue+elemrnt ui return to the top of the table when turning pages

related codes

  <el-pagination class="pagination" @size-change="handleSizeChange" @current-change="handleCurrentChange"
                 :current-page.sync="listQuery.page"
                 :page-sizes="[20, 50, 100, 200]" :page-size="listQuery.limit"
                 layout="total, sizes, prev, pager, next, jumper" :total="cptInfoTotal">
  </el-pagination>

problem description

after clicking on the next page, or after clicking on a few pages, the table is now turned to the bottom, and after turning the page, it is still at the bottom. How to make the table show the top

after turning the page?

clipboard.png

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

topic description

sources of topics and their own ideas

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?


when you click, just find the element you want to roll to the top scrollTop=0 .

function scrollTop(selector) {
    let element = selector && document.querySelector(selector) || window;
    element.scrollTo(0, 0);
}

scrollTop("-sharptable");

scrollTop();

when loading the table, leave the table data empty first, this.tableData = [].
but the downside of writing this way is that the page flashes a little.


in theory, the table and the page number should be on the same page. There should be no scroll bars. You should make the form and page number just fill the page

.
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-1b3603a-4ec44.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-1b3603a-4ec44.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?