UNPKG

@fmdevui/fm-dev

Version:

Page level components developed based on Element Plus.

78 lines (73 loc) 2.16 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var vue = require('vue'); var _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...{ name: "FmButton" }, __name: "index", props: { time: { default: 1e3 }, tip: { default: "" }, placement: { default: "top" }, tipProps: { default: () => ({}) }, isDebounce: { type: Boolean, default: true } }, emits: ["click"], setup(__props, { emit: __emit }) { const props = __props; const emits = __emit; const record = vue.ref(0); const handleClick = () => { if (!props.isDebounce) return emits("click"); const newTime = /* @__PURE__ */ new Date(); if (newTime.getTime() - record.value > props.time) { emits("click"); } record.value = newTime.getTime(); }; return (_ctx, _cache) => { const _component_el_button = vue.resolveComponent("el-button"); const _component_el_tooltip = vue.resolveComponent("el-tooltip"); return _ctx.tip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, vue.mergeProps({ key: 0, content: _ctx.tip, placement: _ctx.placement }, _ctx.tipProps), { default: vue.withCtx(() => [ vue.createVNode( _component_el_button, vue.mergeProps(_ctx.$attrs, { class: "fm-button-tip", onClick: handleClick }), { default: vue.withCtx(() => [ vue.renderSlot(_ctx.$slots, "default") ]), _: 3 /* FORWARDED */ }, 16 /* FULL_PROPS */ ) ]), _: 3 /* FORWARDED */ }, 16, ["content", "placement"])) : (vue.openBlock(), vue.createBlock( _component_el_button, vue.mergeProps({ key: 1 }, _ctx.$attrs, { onClick: handleClick }), { default: vue.withCtx(() => [ vue.renderSlot(_ctx.$slots, "default") ]), _: 3 /* FORWARDED */ }, 16 /* FULL_PROPS */ )); }; } }); exports.default = _sfc_main;