vuux
Version:
Vue3 Nuxt3 Nuxt4 组件库
59 lines (58 loc) • 2.13 kB
JavaScript
import { defineComponent as P, createElementBlock as r, createCommentVNode as l, unref as e, openBlock as i, normalizeClass as g, createElementVNode as I, withModifiers as u, createVNode as m, Fragment as N, renderList as $, toDisplayString as B } from "vue";
import { usePagination as b } from "./hook/usePagination.mjs";
import { Icon as p } from "@vuux/icons";
const x = ["onClick"], w = /* @__PURE__ */ P({
name: "Pagination",
__name: "index",
props: {
total: { default: 0 },
pageSize: { default: 10 },
pageNum: { default: 1 },
background: { type: Boolean },
hide: { type: Boolean },
morePageCount: { default: 2 }
},
emits: ["change"],
setup(f, { emit: v }) {
const d = f, C = v, { currentMorePageCount: c, currentNum: o, totalPages: k, isHide: y, pages: s, handlePage: a } = b(d, C);
return (V, n) => e(y) ? (i(), r("div", {
key: 0,
class: g(["app-pagination", { "is-background": d.background }])
}, [
I("ul", null, [
e(o) > 1 ? (i(), r("li", {
key: 0,
onClick: n[0] || (n[0] = u((t) => e(a)(e(o) - 1), ["prevent"]))
}, [
m(e(p), { name: "Icon3498333" })
])) : l("", !0),
e(s)[1] > 2 ? (i(), r("li", {
key: 1,
onClick: n[1] || (n[1] = u((t) => e(a)(e(o) - e(c)), ["prevent"]))
}, [
m(e(p), { name: "Icon1483701" })
])) : l("", !0),
(i(!0), r(N, null, $(e(s), (t) => (i(), r("li", {
key: t,
class: g({ "is-active": t === e(o) }),
onClick: u((z) => e(a)(t), ["prevent"])
}, B(t), 11, x))), 128)),
e(s)[e(s).length - 2] < e(k) - 1 ? (i(), r("li", {
key: 2,
onClick: n[2] || (n[2] = u((t) => e(a)(e(o) + e(c)), ["prevent"]))
}, [
m(e(p), { name: "Icon1483701" })
])) : l("", !0),
e(o) < e(k) ? (i(), r("li", {
key: 3,
onClick: n[3] || (n[3] = u((t) => e(a)(e(o) + 1), ["prevent"]))
}, [
m(e(p), { name: "Icon6657361" })
])) : l("", !0)
])
], 2)) : l("", !0);
}
});
export {
w as default
};