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
Websites without https support will gradually be ...
Flex(彈性布局) in CSS can flexibly control the layout...
If you are looking to monitor your system interac...
In the SQL like statement, for example SELECT * F...
/********************** * Linux memory management...
MongoDB is cross-platform and can be installed on...
1. delete delete is the only real way to remove a...
Since I have parsed HTML before, I want to use Vu...
Use ES6 modular development and observer mode to ...
Today, it suddenly occurred to me that it would be...
Mysql limit paging statement usage Compared with ...
This article records the graphic tutorial of MySQ...
Table of contents The CSS custom variable functio...
I. Introduction 1: SSL Certificate My domain name...
This article records the method of sharing files ...