Vue.js el-scrollbar Scroll Guide
You can use the scrollTo method to scroll the el-scrollbar to a specific position. Here is an example:
<template>
<el-scrollbar ref="scrollbar" style="height: 200px; width: 200px;">
<!-- 内容 -->
</el-scrollbar>
</template>
<script>
export default {
mounted() {
// 将 el-scrollbar 滚动到指定位置
this.$refs.scrollbar.scrollTo(0, 100);
}
}
</script>
In the example above, we used this.$refs.scrollbar.scrollTo(0, 100) to scroll the el-scrollbar to 0 pixels horizontally and 100 pixels vertically. You can adjust the parameters as needed to scroll to different positions.