UNPKG

asp-smart-ui-plus-test

Version:

A Component Library for Vue 3

41 lines (36 loc) 962 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var vue = require('vue'); var preventScoll = require('../../utils/preventScoll.js'); function usePopup() { const popupProps = vue.ref({ isShow: false, popupComponentName: null }); const showPopup = (componentName, callback) => { popupProps.value.isShow = true; preventScoll.preventScroll(true); popupProps.value.popupComponentName = componentName; callback && callback(); }; const hidePopup = () => { popupProps.value.isShow = false; preventScoll.preventScroll(false); }; const handlePopupEvent = (eventHandlers, event) => { const { type, params } = event; const handler = eventHandlers[type]; if (handler) { handler(params); } else { console.warn(`Unhandled event type: ${type}`); } }; return { showPopup, hidePopup, popupProps, handlePopupEvent }; } exports.usePopup = usePopup;