完全跑通1.0版本
This commit is contained in:
26
frontend/node_modules/element-plus/lib/hooks/use-modal/index.js
generated
vendored
Normal file
26
frontend/node_modules/element-plus/lib/hooks/use-modal/index.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
require("../../_virtual/_rolldown/runtime.js");
|
||||
const require_aria = require("../../constants/aria.js");
|
||||
const require_event = require("../../utils/dom/event.js");
|
||||
let _vueuse_core = require("@vueuse/core");
|
||||
let vue = require("vue");
|
||||
//#region ../../packages/hooks/use-modal/index.ts
|
||||
const modalStack = [];
|
||||
const closeModal = (e) => {
|
||||
if (modalStack.length === 0) return;
|
||||
if (require_event.getEventCode(e) === require_aria.EVENT_CODE.esc) {
|
||||
e.stopPropagation();
|
||||
modalStack[modalStack.length - 1].handleClose();
|
||||
}
|
||||
};
|
||||
const useModal = (instance, visibleRef) => {
|
||||
(0, vue.watch)(visibleRef, (val) => {
|
||||
if (val) modalStack.push(instance);
|
||||
else modalStack.splice(modalStack.indexOf(instance), 1);
|
||||
});
|
||||
};
|
||||
if (_vueuse_core.isClient) (0, _vueuse_core.useEventListener)(document, "keydown", closeModal);
|
||||
//#endregion
|
||||
exports.useModal = useModal;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
Reference in New Issue
Block a user