mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2026-03-17 11:13:35 +00:00
优化
This commit is contained in:
parent
2cb2a94638
commit
d31c65d4cb
@ -97,32 +97,8 @@ const ClContextMenu = defineComponent({
|
||||
// 显示
|
||||
visible.value = true;
|
||||
|
||||
nextTick(() => {
|
||||
const el = refs["context-menu"].querySelector(".cl-context-menu__box");
|
||||
|
||||
// 计算位置
|
||||
let left = event.pageX;
|
||||
let top = event.pageY;
|
||||
|
||||
// 组件方式用 offset 计算
|
||||
if (!props.show) {
|
||||
left = event.offsetX;
|
||||
top = event.offsetY;
|
||||
}
|
||||
|
||||
const { clientHeight: h1, clientWidth: w1 } = event.target?.ownerDocument.body;
|
||||
const { clientHeight: h2, clientWidth: w2 } = el;
|
||||
|
||||
if (top + h2 > h1) {
|
||||
top = h1 - h2 - 5;
|
||||
}
|
||||
|
||||
if (left + w2 > w1) {
|
||||
left = w1 - w2 - 5;
|
||||
}
|
||||
|
||||
style.left = left + "px";
|
||||
style.top = top + "px";
|
||||
// 元素
|
||||
const el = refs["context-menu"].querySelector(".cl-context-menu__box") as HTMLElement;
|
||||
|
||||
// 点击样式
|
||||
if (options?.hover) {
|
||||
@ -149,7 +125,32 @@ const ClContextMenu = defineComponent({
|
||||
if (options?.list) {
|
||||
list.value = parseList(options.list);
|
||||
}
|
||||
});
|
||||
|
||||
nextTick(() => {
|
||||
// 计算位置
|
||||
let left = event.pageX;
|
||||
let top = event.pageY;
|
||||
|
||||
// 组件方式用 offset 计算
|
||||
if (!props.show) {
|
||||
left = event.offsetX;
|
||||
top = event.offsetY;
|
||||
}
|
||||
|
||||
const { clientHeight: h1, clientWidth: w1 } = event.target?.ownerDocument.body;
|
||||
const { clientHeight: h2, clientWidth: w2 } = el;
|
||||
|
||||
if (top + h2 > h1) {
|
||||
top = h1 - h2 - 5;
|
||||
}
|
||||
|
||||
if (left + w2 > w1) {
|
||||
left = w1 - w2 - 5;
|
||||
}
|
||||
|
||||
style.left = left + "px";
|
||||
style.top = top + "px";
|
||||
})
|
||||
|
||||
return {
|
||||
close
|
||||
|
||||
@ -205,7 +205,7 @@ export function parseExtensionComponent(vnode: any) {
|
||||
);
|
||||
case "el-checkbox-group":
|
||||
return (
|
||||
<el-checkbox key={i} label={value} {...e.props}>
|
||||
<el-checkbox key={i} value={value} {...e.props}>
|
||||
{label}
|
||||
</el-checkbox>
|
||||
);
|
||||
|
||||
@ -10,7 +10,7 @@ import { type Router, storage, module } from '/@/cool';
|
||||
import { isArray } from 'lodash-es';
|
||||
import { useBase } from '/$/base';
|
||||
import { Loading } from '../utils';
|
||||
import { config } from '/@/config';
|
||||
import { config, isDev } from '/@/config';
|
||||
|
||||
// 基本路径
|
||||
const baseUrl = import.meta.env.BASE_URL;
|
||||
@ -59,8 +59,10 @@ router.onError((err: Error) => {
|
||||
|
||||
// 动态加载组件错误,刷新页面
|
||||
if (err.message?.includes('Failed to fetch dynamically imported module')) {
|
||||
if (!isDev) {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
lock = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user