UNPKG

birdpaper-ui

Version:

一个通用的 vue3 UI组件库。A common vue3 UI component library.

61 lines (60 loc) 2.08 kB
"use strict"; const vue = require("vue"); const __default__ = vue.defineComponent({ name: "PaginationSizes" }); const _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...__default__, props: { currentSize: { type: Number, default: "" }, sizesList: { type: Array, default: () => [] }, tmpString: { type: String, default: "" } }, emits: ["change"], setup(__props, { emit: emits }) { const props = __props; const name = "bp-pagination"; const val = vue.ref(props.currentSize || props.sizesList[0] || 10); const paramsStr = "{value}"; const list = vue.ref([]); const onChange = (v) => { emits("change", v); }; vue.watchEffect(() => { for (let i = 0; i < props.sizesList.length; i++) { const value = props.sizesList[i]; const label = `${props.tmpString.replace(paramsStr, value)}`; list.value.push({ label, value }); } }); return (_ctx, _cache) => { const _component_bp_option = vue.resolveComponent("bp-option"); const _component_bp_select = vue.resolveComponent("bp-select"); return vue.openBlock(), vue.createElementBlock("li", { class: vue.normalizeClass(`${name}-item ${name}-sizes`) }, [ vue.createVNode(_component_bp_select, { modelValue: val.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => val.value = $event), style: { "width": "100px" }, onChange }, { default: vue.withCtx(() => [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(list.value, (v) => { return vue.openBlock(), vue.createBlock(_component_bp_option, { value: v.value }, { default: vue.withCtx(() => [ vue.createTextVNode(vue.toDisplayString(v.label), 1) ]), _: 2 }, 1032, ["value"]); }), 256)) ]), _: 1 }, 8, ["modelValue"]) ], 2); }; } }); module.exports = _sfc_main;