vuux
Version:
Vue3 Nuxt3 Nuxt4 组件库
92 lines (91 loc) • 3.21 kB
JavaScript
import { defineComponent as B, resolveComponent as V, createElementBlock as i, createCommentVNode as s, unref as e, openBlock as l, normalizeClass as v, createElementVNode as b, createVNode as o, withModifiers as m, withCtx as d, Fragment as M, renderList as h, createTextVNode as q, toDisplayString as w } from "vue";
import { useNuxtPagination as z } from "./hook/useNuxtPagination.mjs";
import { Icon as p } from "@vuux/icons";
const E = { key: 0 }, F = { key: 1 }, S = { key: 2 }, T = { key: 3 }, G = /* @__PURE__ */ B({
name: "NuxtPagination",
__name: "nuxt",
props: {
total: { default: 0 },
pageSize: { default: 10 },
pageNum: { default: 1 },
background: { type: Boolean },
hide: { type: Boolean },
queryField: { default: "?page=" },
morePageCount: { default: 2 }
},
emits: ["update:pageNum"],
setup(f, { emit: C }) {
const k = f, y = C, { currentNum: r, totalPages: g, isHide: N, queryTxet: _, pages: c, toPrev: x, toNext: P, leftMore: I, rightMore: $, setPage: a } = z(k, y);
return (D, n) => {
const u = V("router-link");
return e(N) ? (l(), i("div", {
key: 0,
class: v(["app-pagination", { "is-background": k.background }])
}, [
b("ul", null, [
e(r) > 1 ? (l(), i("li", E, [
o(u, {
to: e(x),
onClick: n[0] || (n[0] = m((t) => e(a)(e(r) - 1), ["prevent"]))
}, {
default: d(() => [
o(e(p), { name: "Icon3498333" })
]),
_: 1
}, 8, ["to"])
])) : s("", !0),
e(c)[1] > 2 ? (l(), i("li", F, [
o(u, {
to: e(I),
onClick: n[1] || (n[1] = m((t) => e(a)(e(r) - f.morePageCount), ["prevent"]))
}, {
default: d(() => [
o(e(p), { name: "Icon1483701" })
]),
_: 1
}, 8, ["to"])
])) : s("", !0),
(l(!0), i(M, null, h(e(c), (t) => (l(), i("li", {
key: t,
class: v({ "is-active": t === e(r) })
}, [
o(u, {
to: e(_) + t,
onClick: m((H) => e(a)(t), ["prevent"])
}, {
default: d(() => [
q(w(t), 1)
]),
_: 2
}, 1032, ["to", "onClick"])
], 2))), 128)),
e(c)[e(c).length - 2] < e(g) - 1 ? (l(), i("li", S, [
o(u, {
to: e($),
onClick: n[2] || (n[2] = m((t) => e(a)(e(r) + f.morePageCount), ["prevent"]))
}, {
default: d(() => [
o(e(p), { name: "Icon1483701" })
]),
_: 1
}, 8, ["to"])
])) : s("", !0),
e(r) < e(g) ? (l(), i("li", T, [
o(u, {
to: e(P),
onClick: n[3] || (n[3] = m((t) => e(a)(e(r) + 1), ["prevent"]))
}, {
default: d(() => [
o(e(p), { name: "Icon6657361" })
]),
_: 1
}, 8, ["to"])
])) : s("", !0)
])
], 2)) : s("", !0);
};
}
});
export {
G as default
};