mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-11 13:02:49 +00:00
优化
This commit is contained in:
parent
2cb2a94638
commit
d31c65d4cb
@ -97,9 +97,36 @@ const ClContextMenu = defineComponent({
|
||||
// 显示
|
||||
visible.value = true;
|
||||
|
||||
nextTick(() => {
|
||||
const el = refs["context-menu"].querySelector(".cl-context-menu__box");
|
||||
// 元素
|
||||
const el = refs["context-menu"].querySelector(".cl-context-menu__box") as HTMLElement;
|
||||
|
||||
// 点击样式
|
||||
if (options?.hover) {
|
||||
const d = options.hover === true ? {} : options.hover;
|
||||
targetEl = event.target;
|
||||
|
||||
if (targetEl && isString(targetEl.className)) {
|
||||
if (d.target) {
|
||||
while (!targetEl.className.includes(d.target)) {
|
||||
targetEl = targetEl.parentNode;
|
||||
}
|
||||
}
|
||||
|
||||
addClass(targetEl, d.className || "cl-context-menu__target");
|
||||
}
|
||||
}
|
||||
|
||||
// 自定义样式
|
||||
if (options?.class) {
|
||||
addClass(el, options.class);
|
||||
}
|
||||
|
||||
// 菜单列表
|
||||
if (options?.list) {
|
||||
list.value = parseList(options.list);
|
||||
}
|
||||
|
||||
nextTick(() => {
|
||||
// 计算位置
|
||||
let left = event.pageX;
|
||||
let top = event.pageY;
|
||||
@ -123,33 +150,7 @@ const ClContextMenu = defineComponent({
|
||||
|
||||
style.left = left + "px";
|
||||
style.top = top + "px";
|
||||
|
||||
// 点击样式
|
||||
if (options?.hover) {
|
||||
const d = options.hover === true ? {} : options.hover;
|
||||
targetEl = event.target;
|
||||
|
||||
if (targetEl && isString(targetEl.className)) {
|
||||
if (d.target) {
|
||||
while (!targetEl.className.includes(d.target)) {
|
||||
targetEl = targetEl.parentNode;
|
||||
}
|
||||
}
|
||||
|
||||
addClass(targetEl, d.className || "cl-context-menu__target");
|
||||
}
|
||||
}
|
||||
|
||||
// 自定义样式
|
||||
if (options?.class) {
|
||||
addClass(el, options.class);
|
||||
}
|
||||
|
||||
// 菜单列表
|
||||
if (options?.list) {
|
||||
list.value = parseList(options.list);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
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,7 +59,9 @@ router.onError((err: Error) => {
|
||||
|
||||
// 动态加载组件错误,刷新页面
|
||||
if (err.message?.includes('Failed to fetch dynamically imported module')) {
|
||||
window.location.reload();
|
||||
if (!isDev) {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user