Element UI implements multiple tables scrolling at the same time, horizontally and vertically The code is as follows: <script src="//unpkg.com/vue/dist/vue.js"></script> <script src="//unpkg.com/[email protected]/lib/index.js"></script> <div id="app"> <template> <el-table ref="table1" border="10" height="150" :data="tableData" style="width: 800px"> <el-table-column prop="date" label="Date" width="300"> </el-table-column> <el-table-column prop="name" label="Name" width="300"> </el-table-column> <el-table-column width="300px" prop="address" label="Address"> </el-table-column> <el-table-column width="300px" prop="address" label="Address"> </el-table-column> </el-table> <br/> <el-table ref="table2" border="10" height="150" :data="tableData" style="width: 800px"> <el-table-column prop="date" label="Date" width="300"> </el-table-column> <el-table-column prop="name" label="Name" width="300"> </el-table-column> <el-table-column width="300px" prop="address" label="Address"> </el-table-column> <el-table-column width="300px" prop="address" label="Address"> </el-table-column> </el-table> </template> </div> var Main = { data() { return { tableData: [{ date: '2016-05-02', name: 'Wang Xiaohu', address: 'Shanghai' }, { date: '2016-05-04', name: 'Wang Xiaohu', address: 'Shanghai' }, { date: '2016-05-04', name: 'Wang Xiaohu', address: 'Shanghai' }, { date: '2016-05-04', name: 'Wang Xiaohu', address: 'Shanghai' }], dom1: null, dom2: null } }, mounted() { this.dom1 = this.$refs.table1.bodyWrapper this.dom2 = this.$refs.table2.bodyWrapper this.listenerScroll() }, methods: { listenerScroll() { this.dom2.addEventListener('scroll', () => { // Scroll this.dom1.scrollLeft = this.dom2.scrollLeft // Vertical scroll this.dom1.scrollTop = this.dom2.scrollTop }) } } } var Ctor = Vue.extend(Main) new Ctor().$mount('#app') This is the end of this article about how to achieve synchronized scrolling of multiple element tables. For more information about synchronized scrolling of element tables, please search previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Detailed explanation of the Docker deployment tutorial for Jenkins beginners
>>: Explanation of the execution priority of mySQL keywords
In the front-end and back-end separation developm...
Result:Implementation Code html <link href=...
What is the main function of Docker? At present, ...
We don’t often encounter 404 pages when we browse...
Table of contents 1. Event Processing Model 1. Ev...
Now if you want to use the video tag in a page, y...
By default, MySQL character types are not case-se...
Block-level element features : •Always occupies a ...
Question 1: When entering net start mysql during ...
Recently, a system was deployed, using nginx as a...
The original code is this: <div class='con...
The following is some basic sql knowledge I have ...
The default varchar type in MySQL is case insensi...
Mine is: <!DOCTYPE html> Blog Garden: <!...
In our recent project, we need to use Google robo...