mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2026-03-19 04:03:49 +00:00
优化
This commit is contained in:
parent
2cb2a94638
commit
d31c65d4cb
@ -97,9 +97,36 @@ const ClContextMenu = defineComponent({
|
|||||||
// 显示
|
// 显示
|
||||||
visible.value = true;
|
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 left = event.pageX;
|
||||||
let top = event.pageY;
|
let top = event.pageY;
|
||||||
@ -123,33 +150,7 @@ const ClContextMenu = defineComponent({
|
|||||||
|
|
||||||
style.left = left + "px";
|
style.left = left + "px";
|
||||||
style.top = top + "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 {
|
return {
|
||||||
close
|
close
|
||||||
|
|||||||
@ -205,7 +205,7 @@ export function parseExtensionComponent(vnode: any) {
|
|||||||
);
|
);
|
||||||
case "el-checkbox-group":
|
case "el-checkbox-group":
|
||||||
return (
|
return (
|
||||||
<el-checkbox key={i} label={value} {...e.props}>
|
<el-checkbox key={i} value={value} {...e.props}>
|
||||||
{label}
|
{label}
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import { type Router, storage, module } from '/@/cool';
|
|||||||
import { isArray } from 'lodash-es';
|
import { isArray } from 'lodash-es';
|
||||||
import { useBase } from '/$/base';
|
import { useBase } from '/$/base';
|
||||||
import { Loading } from '../utils';
|
import { Loading } from '../utils';
|
||||||
import { config } from '/@/config';
|
import { config, isDev } from '/@/config';
|
||||||
|
|
||||||
// 基本路径
|
// 基本路径
|
||||||
const baseUrl = import.meta.env.BASE_URL;
|
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')) {
|
if (err.message?.includes('Failed to fetch dynamically imported module')) {
|
||||||
window.location.reload();
|
if (!isDev) {
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user