我想通过element-ui 来分页,设置每页显示的条数,但还是会把所有数据显示出来。
<el-pagination @size-change="handleSizeChange" @currentchange="handleCurrentChange" :current-page.sync="currentPage1"
:page-sizes="[10,20,30, 50]" :page-size="10" layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
我的数据是自己生成的,一次生成30条,我想让不要一页显示出来,但是效果是每次都把30条给显示出来了
mockTableData1 () {
let data = []
for (let i = 0; i < 30; i++) {
data.push({
id: this.inde++,
stid: Math.floor(Math.random() * 10000 + 1),
name: 'ABC' + Math.floor(Math.random() * 100 + 1),
sex: '男',
time: Math.random() * 1000 + 1,
cm: Math.random() * 1000 + 100,
kg: Math.random() * 100 + 10,
totaltuition: 24000,
submitted: 1000,
submittes: 2300,
isover: 'N'
})
}
这是什么原因?
<el-table>
和el-pagination
两个组件没有任何关联。想要一页显示多少条,需要通过
el-pagination
中的size-change
和current-change
事件 手动控制data
属性值。