mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +08:00
28 lines
452 B
Markdown
28 lines
452 B
Markdown
|
# 每页条数
|
||
|
```html
|
||
|
<n-pagination
|
||
|
v-model="page"
|
||
|
:page-count="100"
|
||
|
show-size-picker
|
||
|
:page-size="pageSize"
|
||
|
:page-sizes="[10, 20, 30, 40]"
|
||
|
@page-size-change="handlePageSizeChange"
|
||
|
/>
|
||
|
```
|
||
|
|
||
|
```js
|
||
|
export default {
|
||
|
data () {
|
||
|
return {
|
||
|
page: 2,
|
||
|
pageSize: 20
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
handlePageSizeChange (pageSize) {
|
||
|
this.pageSize = pageSize
|
||
|
this.$NMessage.info(`Page size is set to ${pageSize}`)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
```
|