UNPKG

asp-smart-ui-plus-test

Version:

A Component Library for Vue 3

58 lines (55 loc) 2.29 kB
import { defineComponent, resolveComponent, openBlock, createElementBlock, normalizeClass, Fragment, renderList, createBlock, mergeProps, toHandlers, withCtx, createTextVNode, toDisplayString, createCommentVNode } from 'vue'; import _export_sfc from '../../../../../_virtual/plugin-vue_export-helper.mjs'; const __default__ = defineComponent({ name: "AspButtonList" }); const _sfc_main = /* @__PURE__ */ defineComponent({ ...__default__, props: { buttonList: { type: Array, required: true }, position: { type: String, required: false } }, setup(__props) { const handleClick = (item) => { if (typeof item.clickFunc !== "function") { return; } item.clickFunc && item.clickFunc(); }; const operationDisabled = (item) => { if (typeof item.disabledFunc === "function") { return item.disabledFunc(); } return !!item.disabled; }; const operationShow = (btn) => { if (typeof btn.showFunc === "function") { return btn.showFunc(); } return btn.show === void 0 ? true : !!btn.show; }; return (_ctx, _cache) => { const _component_asp_button = resolveComponent("asp-button"); return openBlock(), createElementBlock("div", { class: normalizeClass(["asp-button-list", "is_" + __props.position]) }, [ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.buttonList, (item, index) => { return openBlock(), createElementBlock(Fragment, null, [ operationShow(item) ? (openBlock(), createBlock(_component_asp_button, mergeProps({ key: index }, item, { disabled: operationDisabled(item) }, toHandlers(item.events), { onClick: ($event) => handleClick(item) }), { default: withCtx(() => [ createTextVNode(toDisplayString(item.label), 1) ]), _: 2 }, 1040, ["disabled", "onClick"])) : createCommentVNode("v-if", true) ], 64); }), 256)) ], 2); }; } }); var ButtonList = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "E:\\code\\SmartUIPlus\\asp-packages\\components\\pc\\advanced\\button-list\\src\\button-list.vue"]]); export { ButtonList as default };