fix: page 组件 pages 属性为单数时计算逻辑错误

This commit is contained in:
就眠儀式 2022-04-06 21:30:21 +08:00
parent 303256afa1
commit 0a3f5b94b2
3 changed files with 6 additions and 6 deletions

View File

@ -43,7 +43,7 @@ const props = withDefaults(defineProps<LayPageProps>(), {
}); });
const limits = ref(props.limits); const limits = ref(props.limits);
const pages = Math.ceil(props.pages / 2); const pages = Math.floor(props.pages / 2);
const inlimit = computed({ const inlimit = computed({
get() { get() {

View File

@ -197,8 +197,8 @@ export default {
::: demo ::: demo
<template> <template>
<lay-page :limit="limit1" :pages="pages1" :total="9999" :show-count="showCount1" @limit="limit1=$event" :show-page="showPage1" :show-limit="showLimit1" :show-refresh="showRefresh1" showSkip="showSkip1"></lay-page> <lay-page :limit="limit1" :pages="pages1" :total="total1" :show-count="showCount1" @limit="limit1=$event" :show-page="showPage1" :show-limit="showLimit1" :show-refresh="showRefresh1" showSkip="showSkip1"></lay-page>
每页数量:{{limit}} 每页数量:{{limit1}}
</template> </template>
<script> <script>
@ -208,13 +208,13 @@ export default {
setup() { setup() {
const limit1 = ref(5) const limit1 = ref(5)
const total1 = ref(9999) const total1 = ref(99)
const showCount1 = ref(true) const showCount1 = ref(true)
const showPage1 = ref(true) const showPage1 = ref(true)
const showLimit1 = ref(true) const showLimit1 = ref(true)
const showRefresh1 = ref(true) const showRefresh1 = ref(true)
const showSkip1 = ref(true) const showSkip1 = ref(true)
const pages1 = ref(3); const pages1 = ref(6);
return { return {
limit1, limit1,

View File

@ -3,7 +3,7 @@ import { App, createApp as _createApp } from "vue";
import { createRouter } from "./router/index"; import { createRouter } from "./router/index";
import { Router } from "vue-router"; import { Router } from "vue-router";
import Store from "./store"; import Store from "./store";
import layui from '../../component/src/index' import layui from "../../component/src/index";
import LayCode from "./components/LayCode.vue"; import LayCode from "./components/LayCode.vue";
import LaySearch from "./components/LaySearch.vue"; import LaySearch from "./components/LaySearch.vue";
import LayTableBox from "./components/LayTableBox.vue"; import LayTableBox from "./components/LayTableBox.vue";