After the scrollbar appears in the div box, is there any way to assign the value back to the top without refreshing the page?

now is a div quilt data props up the scroll bar, inside is an element table, when the scroll bar slides to the bottom, select paging, the scroll bar will not return to the top, or in the original position, how to get back to the top? Not a browser scroll bar

Jun.06,2022

external div setting overflow:scroll , then click Action to scroll directly to the top

<template>
    <div class="container" ref="container">
        <table>
            <tr>
                <td>hhhhhh</td>
                <td>111111</td>
            </tr>
            <tr>
                <td>hhhhhh</td>
                <td>111111</td>
            </tr>
            <tr>
                <td>hhhhhh</td>
                <td>111111</td>
            </tr>
            <tr>
                <td>hhhhhh</td>
                <td>111111</td>
            </tr>
            <tr>
                <td>hhhhhh</td>
                <td>111111</td>
            </tr>
            <tr>
                <td>hhhhhh</td>
                <td>111111</td>
            </tr>
        </table>
        <button @click="backTop"></button>
    </div>
</template>
<script>
export default {
  props: {
    data: String
  },
  components: {},
  data () {
    return {
    }
  },
  methods: {
    backTop () {
      console.log(this.$refs.container.scrollTop)
      this.$refs.container.scrollTop = 0
    }
  }
}
</script>
<style scoped>
.container{
  height: 500px;
  background: -sharpffffff;
  overflow: scroll;
}
tr{
    height: 200px;
}
</style>

clipboard.png


after clicking to turn the page, you can directly use js to set the scrollTop attribute value of this div to 0.


iview hopes to help you https://www.iviewui.com/compo...

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