UNPKG

@oiij/naive-ui

Version:

Some Composable Functions And Components for Vue 3

31 lines (29 loc) 1.23 kB
import { createBlock, createTextVNode, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, renderSlot, toDisplayString, unref, withCtx } from "vue"; import { NButton, NTooltip } from "naive-ui"; //#region src/components/tooltip-button/TooltipButton.vue const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "TooltipButton", props: { tooltip: {}, tooltipProps: {}, buttonProps: {} }, emits: ["click"], setup(__props, { emit: __emit }) { const emit = __emit; return (_ctx, _cache) => { return openBlock(), createBlock(unref(NTooltip), normalizeProps(guardReactiveProps(__props.tooltipProps)), { trigger: withCtx(() => [createVNode(unref(NButton), mergeProps(__props.buttonProps, { onClick: _cache[0] || (_cache[0] = (ev) => emit("click", ev)) }), { icon: withCtx(() => [renderSlot(_ctx.$slots, "icon")]), default: withCtx(() => [renderSlot(_ctx.$slots, "default")]), _: 3 }, 16)]), default: withCtx(() => [renderSlot(_ctx.$slots, "tooltip", {}, () => [createTextVNode(toDisplayString(__props.tooltip), 1)])]), _: 3 }, 16); }; } }); var TooltipButton_default = _sfc_main; //#endregion export { TooltipButton_default as default };