- Vue 3 + TypeScript + Element Plus 前端界面 - Pinia 状态管理 - Vue Router 4 路由管理 - Axios HTTP 客户端 - MSW (Mock Service Worker) 开发环境模拟 - 账户管理界面 (列表、详情、三科目余额展示) - 交易管理界面 (列表、详情) - 对账管理界面 (三账校验) - 完善的 API 客户端封装 - Docker 容器化配置 - Nginx 配置用于生产环境
55 lines
1.8 KiB
JavaScript
55 lines
1.8 KiB
JavaScript
'use strict';
|
|
|
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
|
var vue = require('vue');
|
|
var index = require('../use-namespace/index.js');
|
|
var error = require('../../utils/error.js');
|
|
var style = require('../../utils/dom/style.js');
|
|
var scroll = require('../../utils/dom/scroll.js');
|
|
|
|
const useLockscreen = (trigger, options = {}) => {
|
|
if (!vue.isRef(trigger)) {
|
|
error.throwError(
|
|
"[useLockscreen]",
|
|
"You need to pass a ref param to this function"
|
|
);
|
|
}
|
|
const ns = options.ns || index.useNamespace("popup");
|
|
const hiddenCls = vue.computed(() => ns.bm("parent", "hidden"));
|
|
let scrollBarWidth = 0;
|
|
let withoutHiddenClass = false;
|
|
let bodyWidth = "0";
|
|
const cleanup = () => {
|
|
setTimeout(() => {
|
|
if (typeof document === "undefined")
|
|
return;
|
|
if (withoutHiddenClass && document) {
|
|
document.body.style.width = bodyWidth;
|
|
style.removeClass(document.body, hiddenCls.value);
|
|
}
|
|
}, 200);
|
|
};
|
|
vue.watch(trigger, (val) => {
|
|
if (!val) {
|
|
cleanup();
|
|
return;
|
|
}
|
|
withoutHiddenClass = !style.hasClass(document.body, hiddenCls.value);
|
|
if (withoutHiddenClass) {
|
|
bodyWidth = document.body.style.width;
|
|
style.addClass(document.body, hiddenCls.value);
|
|
}
|
|
scrollBarWidth = scroll.getScrollBarWidth(ns.namespace.value);
|
|
const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
|
|
const bodyOverflowY = style.getStyle(document.body, "overflowY");
|
|
if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
|
|
document.body.style.width = `calc(100% - ${scrollBarWidth}px)`;
|
|
}
|
|
});
|
|
vue.onScopeDispose(() => cleanup());
|
|
};
|
|
|
|
exports.useLockscreen = useLockscreen;
|
|
//# sourceMappingURL=index.js.map
|