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

240 lines
3.5 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>
2021-10-15 14:27:58 +08:00
<lay-page :limit="limit" :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>
2021-10-15 09:30:37 +08:00
<lay-page :limit="limit" :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" :total="total">
<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>
2021-10-15 14:27:58 +08:00
<lay-page :limit="limit" :total="total" :show-page="showPage" theme="red"></lay-page>
2021-10-09 22:20:55 +08:00
<br>
2021-10-15 14:27:58 +08:00
<lay-page :limit="limit" :total="total" :show-page="showPage" theme="blue"></lay-page>
2021-10-09 22:20:55 +08:00
<br>
2021-10-15 14:27:58 +08:00
<lay-page :limit="limit" :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>
:::
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>
2021-10-15 14:27:58 +08:00
<lay-page :limit="limit" :total="total" :show-count="showCount" :show-page="showPage" :show-limit="showLimit" :show-refresh="showRefresh" showSkip="showSkip"></lay-page>
2021-10-09 10:41:52 +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 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
:::
2021-10-26 01:13:23 +08:00
::: title 切换事件
2021-10-19 22:28:44 +08:00
:::
2021-10-11 00:11:54 +08:00
::: demo
<template>
2021-10-15 14:27:58 +08:00
<lay-page :limit="limit" :total="total" @jump="jump" :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>
:::
2021-10-26 01:13:23 +08:00
::: title 分页属性
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` |
2021-11-07 15:55:08 +08:00
:::
2021-10-26 01:13:23 +08:00
::: title 分页事件
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: 当前页面 } |
2021-10-18 22:21:43 +08:00
2021-11-07 15:55:08 +08:00
:::
2021-10-26 01:13:23 +08:00
::: title 分页插槽
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
:::