大神们帮帮我,vue表格如何做到滚动监听?已贴上简单代码
粉丝福利 : 关注VUE中文社区公众号,回复视频领取粉丝福利
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title>vue固定表行头和列头</title>
<script src="js/vue.js"></script>
<script src="js/element.js"></script>
<link rel="stylesheet" href="css/element.css" />
</head>
<body>
<div id="app">
<template>
<el-table :data="tableData" border :height="tableHeight">
<el-table-column fixed prop="name" label="姓名" width="60">
</el-table-column>
<el-table-column prop="province" label="省份" width="60">
</el-table-column>
<el-table-column prop="city" label="市区" width="120">
</el-table-column>
<el-table-column prop="address" label="地址" width="300">
</el-table-column>
<el-table-column prop="zip" label="邮编" width="120">
</el-table-column>
</el-table>
</template>
</div>
</body>
<script>
var vm;
loadPage();
function loadPage() {
vueInit();
vm.tableData = [{
date: '2016-05-03',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1518 弄',
zip: 200333
}, {
date: '2016-05-02',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1518 弄',
zip: 200333
}, {
date: '2016-05-04',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1518 弄',
zip: 200333
}, {
date: '2016-05-07',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1518 弄',
zip: 200333
}, {
date: '2016-05-07',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1518 弄',
zip: 200333
}, {
date: '2016-05-07',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1518 弄',
zip: 200333
}, {
date: '2016-05-07',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1518 弄',
zip: 200333
}];
}
function myScript(e) {
console.log(JSON.stringify(e))
}
function vueInit() {
vm = new Vue({
el: '#app',
data: {
tableData: [],
tableHeight: plus.screen.resolutionHeight - 60,
},
methods: {
handleClick: function(tab, event) {},
handleCurrentChange: function(val) {
vm.currentPage = val;
getTaskList();
},
myScript: function(tab, event) {
console.log(123)
}
}
});
}
</script>
</html>