This commit is contained in:
神仙都没用 2024-11-05 10:32:45 +08:00
parent 2cb2a94638
commit d31c65d4cb
3 changed files with 35 additions and 32 deletions

View File

@ -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

View File

@ -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>
);

View File

@ -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(() => {