layui/example/docs/zh-CN/components/page.md

306 lines
4.8 KiB
Markdown
Raw Normal View History

::: anchor
:::
2021-10-26 01:13:23 +08:00
::: title 基础使用
2021-10-19 22:28:44 +08:00
:::
2021-10-09 10:41:52 +08:00
::: demo
<template>
<lay-page :limit="limit" @limit="limit = $event" :total="total" :show-page="showPage"></lay-page>
2021-10-09 22:20:55 +08:00
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
2021-10-15 09:30:37 +08:00
const limit = ref(20)
const total = ref(100)
2021-10-15 14:27:58 +08:00
const showPage = ref(true)
2021-10-15 09:30:37 +08:00
2021-10-09 22:20:55 +08:00
return {
2021-10-15 09:30:37 +08:00
limit,
2021-10-15 14:27:58 +08:00
total,
showPage
2021-10-09 22:20:55 +08:00
}
}
}
</script>
:::
2021-10-26 01:13:23 +08:00
::: title 简单模式
2021-10-19 22:28:44 +08:00
:::
2021-10-09 22:20:55 +08:00
::: demo
<template>
<lay-page :limit="limit" @limit="limit = $event" :total="total"></lay-page>
2021-10-09 22:20:55 +08:00
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
2021-10-15 09:30:37 +08:00
const limit = ref(20)
const total = ref(100)
2021-10-09 22:20:55 +08:00
return {
2021-10-15 09:30:37 +08:00
limit,
total
2021-10-09 22:20:55 +08:00
}
}
}
</script>
:::
2021-10-26 01:13:23 +08:00
::: title 插槽使用
2021-10-19 22:28:44 +08:00
:::
2021-10-18 22:21:43 +08:00
::: demo
<template>
<lay-page :limit="limit" @limit="limit = $event" :total="total">
2021-10-18 22:21:43 +08:00
<template v-slot:prev></template>
<template v-slot:next></template>
</lay-page>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
const limit = ref(20)
const total = ref(100)
return {
limit,
total
}
}
}
</script>
:::
2021-10-26 01:13:23 +08:00
::: title 不同主题
2021-10-19 22:28:44 +08:00
:::
2021-10-18 22:21:43 +08:00
2021-10-09 22:20:55 +08:00
::: demo
<template>
<lay-page :limit="limit" @limit="limit = $event" :total="total" :show-page="showPage" theme="red"></lay-page>
2021-10-09 22:20:55 +08:00
<br>
<lay-page :limit="limit" @limit="limit = $event" :total="total" :show-page="showPage" theme="blue"></lay-page>
2021-10-09 22:20:55 +08:00
<br>
<lay-page :limit="limit" @limit="limit = $event" :total="total" :show-page="showPage" theme="orange"></lay-page>
2021-10-09 22:20:55 +08:00
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
2021-10-15 09:30:37 +08:00
const limit = ref(20)
const total = ref(100)
2021-10-15 14:27:58 +08:00
const showPage = ref(true)
2021-10-15 09:30:37 +08:00
2021-10-09 22:20:55 +08:00
return {
2021-10-15 09:30:37 +08:00
limit,
2021-10-15 14:27:58 +08:00
total,
showPage
2021-10-09 22:20:55 +08:00
}
}
}
</script>
:::
::: title 指定分页容量
:::
::: demo
<template>
<lay-page :limit="limit" :total="total" showCount showPage :limits="[10,50,100,200]" @limit="limit=$event"></lay-page>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
const limit = ref(20)
const total = ref(100)
return {
limit,
total
}
}
}
</script>
:::
::: title 每页数量切换事件(limit)
:::
::: demo
<template>
<lay-page :limit="limit" showPage showCount :total="total" @limit="limit=$event" :show-limit="showLimit" ></lay-page>
<div>每页数量:{{limit}}</div>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
const limit = ref(5)
const total = ref(9999)
const showLimit = ref(true)
return {
limit,
total,
showLimit,
}
}
}
</script>
2021-10-09 22:20:55 +08:00
:::
2021-10-26 01:13:23 +08:00
::: title 完整分页
2021-10-19 22:28:44 +08:00
:::
2021-10-09 22:20:55 +08:00
::: demo
<template>
<lay-page :limit="limit" :total="9999" :show-count="showCount" @limit="limit=$event" :show-page="showPage" :show-limit="showLimit" :show-refresh="showRefresh" showSkip="showSkip"></lay-page>
每页数量:{{limit}}
2021-10-09 10:41:52 +08:00
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
const limit = ref(5)
const total = ref(9999)
2021-10-15 14:27:58 +08:00
const showCount = ref(true)
const showPage = ref(true)
const showLimit = ref(true)
const showRefresh = ref(true)
const showSkip = ref(true)
2021-10-15 09:30:37 +08:00
2021-10-09 10:41:52 +08:00
return {
2021-10-15 09:30:37 +08:00
limit,
2021-10-15 14:27:58 +08:00
total,
showCount,
showPage,
showLimit,
showRefresh,
showSkip
2021-10-09 10:41:52 +08:00
}
}
}
</script>
2021-10-11 00:11:54 +08:00
:::
::: title 页码切换事件(jump)
2021-10-19 22:28:44 +08:00
:::
2021-10-11 00:11:54 +08:00
::: demo
<template>
<lay-page :limit="limit" :total="total" @jump="jump" @limit="limit = $event" :show-page="showSkip"></lay-page>
2021-10-11 00:11:54 +08:00
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
2021-10-15 09:30:37 +08:00
const limit = ref(20)
const total = ref(100)
2021-10-15 14:27:58 +08:00
const showPage = ref(true)
2021-10-11 00:11:54 +08:00
const jump = function({ current }) {
2021-10-15 09:30:37 +08:00
console.log("当前页:" + current)
2021-10-11 00:11:54 +08:00
}
return {
2021-10-15 09:30:37 +08:00
limit,
total,
2021-10-15 14:27:58 +08:00
jump,
showPage
2021-10-11 00:11:54 +08:00
}
}
}
</script>
:::
2022-01-10 01:17:03 +08:00
::: title Page 属性
2021-10-13 10:04:43 +08:00
:::
2021-10-12 18:00:09 +08:00
2021-11-07 15:55:08 +08:00
::: table
| 属性 | 描述 | 默认值 |
| ----------- | ------------ | ------- |
| limit | 每页数量 | -- |
| total | 总条数 | -- |
| showCount | 显示总数 | `false` |
| showPage | 显示每页 | `false` |
| showLimit | 显示每页数量 | `false` |
2021-10-11 02:33:17 +08:00
| showRefresh | 显示刷新按钮 | `false` |
| showSkip | 显示跳转 | `false` |
| pages | 显示切页按钮数量 | `10` |
| limits | 切换每页数量的选择项 | `[10,20,30,40,50]` |
2021-11-07 15:55:08 +08:00
:::
2022-01-10 01:17:03 +08:00
::: title Page 事件
2021-10-13 10:04:43 +08:00
:::
2021-11-07 15:55:08 +08:00
::: table
| 事件 | 描述 | 参数 |
2021-10-26 01:14:17 +08:00
| ---- | -------- | --------------------- |
| jump | 切换回调 | { current: 当前页面 } |
| limit | 每页数量变化 | 变化后的值 |
2021-10-18 22:21:43 +08:00
2021-11-07 15:55:08 +08:00
:::
2022-01-10 01:17:03 +08:00
::: title Page 插槽
2021-10-18 22:21:43 +08:00
:::
2021-11-07 15:55:08 +08:00
::: table
| 插槽 | 描述 | 默认值 |
2021-10-26 01:14:17 +08:00
| ---- | ------ | ------ |
| prev | 上一页 | 上一页 |
| next | 下一页 | 下一页 |
2021-11-07 15:55:08 +08:00
2021-11-07 15:56:24 +08:00
:::
2021-12-16 17:57:59 +08:00
::: comment
2022-01-12 14:19:06 +08:00
:::
::: previousNext page
2021-12-16 17:57:59 +08:00
:::