various-ui
Version:
This is a test version of the Vue 3 component library
125 lines (122 loc) • 4.8 kB
JavaScript
import { defineComponent, unref, openBlock, createElementBlock, createCommentVNode, renderSlot, createTextVNode, toDisplayString, createElementVNode, normalizeClass, createVNode, Fragment, renderList } from 'vue';
import { UiIcon } from '../../icon/index.mjs';
import { UiPaginationPropsOption, UiPaginationEmits } from './index.mjs';
import { useComposable } from './src/composable.mjs';
const _hoisted_1 = {
key: 0,
class: "ui-pagination"
};
const _hoisted_2 = {
key: 0,
class: "ui-pagination-items"
};
const _hoisted_3 = { class: "ui-pagination-controls" };
const _hoisted_4 = ["onClick"];
const _hoisted_5 = ["onClick"];
const __default__ = defineComponent({ name: "UiPagination" });
var _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: UiPaginationPropsOption,
emits: UiPaginationEmits,
setup(__props, { expose: __expose, emit: __emit }) {
const define = __props;
const emits = __emit;
const { computeds, methods } = useComposable(define, emits);
const { controls, total, info } = computeds;
const { switchNumber, next, back } = methods;
__expose({ switchNumber, next, back });
;
return (_ctx, _cache) => {
return unref(total) ? (openBlock(), createElementBlock("div", _hoisted_1, [
createCommentVNode(" * \u5206\u9875\u4FE1\u606F "),
_ctx.items ? (openBlock(), createElementBlock("div", _hoisted_2, [
renderSlot(_ctx.$slots, "items", {
page: _ctx.modelValue,
limit: _ctx.limit,
total: unref(total),
count: _ctx.count
}, () => [
createTextVNode(
toDisplayString(unref(info)),
1
/* TEXT */
)
])
])) : createCommentVNode("v-if", true),
createCommentVNode(" * \u5206\u9875\u63A7\u5236\u5668 "),
createElementVNode("div", _hoisted_3, [
createCommentVNode(" * \u540E\u9000\u63A7\u5236\u5668 "),
createElementVNode(
"div",
{
class: normalizeClass(["ui-pagination-control ui-next", { "ui-disabled-status": _ctx.modelValue <= 1 }]),
onClick: _cache[0] || (_cache[0] = //@ts-ignore
(...args) => unref(back) && unref(back)(...args))
},
[
renderSlot(_ctx.$slots, "arrow", {}, () => [
createVNode(unref(UiIcon), { name: "arrow" })
])
],
2
/* CLASS */
),
(openBlock(true), createElementBlock(
Fragment,
null,
renderList(unref(controls), (control) => {
return openBlock(), createElementBlock(
Fragment,
{
key: control.type + control.value
},
[
createCommentVNode(" * \u8DF3\u8DC3\u63A7\u5236\u5668 "),
control.type == "skip" ? (openBlock(), createElementBlock("div", {
key: 0,
class: "ui-pagination-control",
onClick: ($event) => unref(switchNumber)(_ctx.modelValue + _ctx.skip * control.value)
}, "...", 8, _hoisted_4)) : (openBlock(), createElementBlock(
Fragment,
{ key: 1 },
[
createCommentVNode(" * \u9009\u62E9\u63A7\u5236\u5668 "),
createElementVNode("div", {
class: normalizeClass(["ui-pagination-control", { "ui-active": control.active }]),
onClick: ($event) => unref(switchNumber)(control.value)
}, toDisplayString(control.value), 11, _hoisted_5)
],
2112
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
))
],
64
/* STABLE_FRAGMENT */
);
}),
128
/* KEYED_FRAGMENT */
)),
createCommentVNode(" * \u524D\u8FDB\u63A7\u5236\u5668 "),
createElementVNode(
"div",
{
class: normalizeClass(["ui-pagination-control ui-back", { "ui-disabled-status": _ctx.modelValue >= unref(total) }]),
onClick: _cache[1] || (_cache[1] = //@ts-ignore
(...args) => unref(next) && unref(next)(...args))
},
[
renderSlot(_ctx.$slots, "arrow", {}, () => [
createVNode(unref(UiIcon), { name: "arrow" })
])
],
2
/* CLASS */
)
])
])) : createCommentVNode("v-if", true);
};
}
});
export { _sfc_main as default };
//# sourceMappingURL=index.vue2.mjs.map