2021-12-30 00:44:43 +08:00
|
|
|
::: anchor
|
|
|
|
:::
|
|
|
|
|
2022-02-08 11:36:36 +08:00
|
|
|
::: title 基本介绍
|
|
|
|
:::
|
|
|
|
|
|
|
|
::: describe 提供极致的分页逻辑,既可轻松胜任异步分页,也可作为页面刷新式分页。
|
|
|
|
:::
|
|
|
|
|
2021-10-26 01:13:23 +08:00
|
|
|
::: title 基础使用
|
2021-10-19 22:28:44 +08:00
|
|
|
:::
|
|
|
|
|
2022-02-02 03:27:34 +08:00
|
|
|
::: demo 使用 `lay-page` 标签, 创建分页
|
2021-10-09 10:41:52 +08:00
|
|
|
|
|
|
|
<template>
|
2022-01-08 11:24:17 +08:00
|
|
|
<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>
|
2022-01-08 11:24:17 +08:00
|
|
|
<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>
|
2022-01-08 11:24:17 +08:00
|
|
|
<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>
|
2022-01-08 11:24:17 +08:00
|
|
|
<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>
|
2022-01-08 11:24:17 +08:00
|
|
|
<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>
|
2022-01-08 11:24:17 +08:00
|
|
|
<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>
|
|
|
|
|
2021-12-27 16:41:57 +08:00
|
|
|
:::
|
|
|
|
|
2022-01-08 11:24:17 +08:00
|
|
|
::: title 指定分页容量
|
2021-12-27 16:41:57 +08:00
|
|
|
:::
|
|
|
|
|
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
2021-12-28 10:45:09 +08:00
|
|
|
<lay-page :limit="limit" :total="total" showCount showPage :limits="[10,50,100,200]" @limit="limit=$event"></lay-page>
|
2021-12-27 16:41:57 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
|
|
|
|
|
|
|
const limit = ref(20)
|
|
|
|
const total = ref(100)
|
|
|
|
|
|
|
|
return {
|
|
|
|
limit,
|
|
|
|
total
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2021-12-27 16:31:40 +08:00
|
|
|
:::
|
|
|
|
|
|
|
|
::: title 每页数量切换事件(limit)
|
|
|
|
:::
|
|
|
|
|
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
2021-12-28 10:45:09 +08:00
|
|
|
<lay-page :limit="limit" showPage showCount :total="total" @limit="limit=$event" :show-limit="showLimit" ></lay-page>
|
2021-12-27 16:31:40 +08:00
|
|
|
<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>
|
2021-12-27 16:31:40 +08:00
|
|
|
<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() {
|
|
|
|
|
2021-12-27 15:16:02 +08:00
|
|
|
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
|
|
|
:::
|
|
|
|
|
2022-01-08 11:24:17 +08:00
|
|
|
::: title 页码切换事件(jump)
|
2021-10-19 22:28:44 +08:00
|
|
|
:::
|
|
|
|
|
2021-10-11 00:11:54 +08:00
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
2022-01-08 11:24:17 +08:00
|
|
|
<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>
|
|
|
|
|
2021-10-11 02:08:35 +08:00
|
|
|
:::
|
|
|
|
|
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
|
|
|
|
|
2021-11-01 01:02:21 +08:00
|
|
|
| 属性 | 描述 | 默认值 |
|
2021-10-12 11:30:07 +08:00
|
|
|
| ----------- | ------------ | ------- |
|
|
|
|
| limit | 每页数量 | -- |
|
|
|
|
| total | 总条数 | -- |
|
|
|
|
| showCount | 显示总数 | `false` |
|
|
|
|
| showPage | 显示每页 | `false` |
|
|
|
|
| showLimit | 显示每页数量 | `false` |
|
2021-10-11 02:33:17 +08:00
|
|
|
| showRefresh | 显示刷新按钮 | `false` |
|
2021-10-12 11:30:07 +08:00
|
|
|
| showSkip | 显示跳转 | `false` |
|
2022-01-08 11:24:17 +08:00
|
|
|
| pages | 显示切页按钮数量 | `10` |
|
|
|
|
| limits | 切换每页数量的选择项 | `[10,20,30,40,50]` |
|
2021-10-13 01:17:19 +08:00
|
|
|
|
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-10-13 01:17:19 +08:00
|
|
|
|
2021-11-07 15:55:08 +08:00
|
|
|
::: table
|
|
|
|
|
2021-11-01 01:02:21 +08:00
|
|
|
| 事件 | 描述 | 参数 |
|
2021-10-26 01:14:17 +08:00
|
|
|
| ---- | -------- | --------------------- |
|
|
|
|
| jump | 切换回调 | { current: 当前页面 } |
|
2022-01-08 11:24:17 +08:00
|
|
|
| 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-11-01 01:02:21 +08:00
|
|
|
| 插槽 | 描述 | 默认值 |
|
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
|
|
|
:::
|