mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-06 00:18:51 +08:00
feat: 路由添加可配置的fixedTag
属性,作用为当前菜单名称是否固定显示在标签页且不可关闭 (#1047)
This commit is contained in:
parent
c0a1b918aa
commit
296db3789b
@ -90,6 +90,10 @@
|
|||||||
padding: 0 12px;
|
padding: 0 12px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fixed-tag {
|
||||||
|
padding: 0 12px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import { onClickOutside } from "@vueuse/core";
|
|||||||
import { handleAliveRoute, getTopMenu } from "@/router/utils";
|
import { handleAliveRoute, getTopMenu } from "@/router/utils";
|
||||||
import { useSettingStoreHook } from "@/store/modules/settings";
|
import { useSettingStoreHook } from "@/store/modules/settings";
|
||||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
import { ref, watch, unref, toRaw, nextTick, onBeforeUnmount } from "vue";
|
import { ref, watch, unref, toRaw, nextTick, onBeforeUnmount } from "vue";
|
||||||
import {
|
import {
|
||||||
delay,
|
delay,
|
||||||
@ -59,6 +60,10 @@ const contextmenuRef = ref();
|
|||||||
const isShowArrow = ref(false);
|
const isShowArrow = ref(false);
|
||||||
const topPath = getTopMenu()?.path;
|
const topPath = getTopMenu()?.path;
|
||||||
const { VITE_HIDE_HOME } = import.meta.env;
|
const { VITE_HIDE_HOME } = import.meta.env;
|
||||||
|
const fixedTags = [
|
||||||
|
...routerArrays,
|
||||||
|
...usePermissionStoreHook().flatteningRoutes.filter(v => v?.meta?.fixedTag)
|
||||||
|
];
|
||||||
|
|
||||||
const dynamicTagView = async () => {
|
const dynamicTagView = async () => {
|
||||||
await nextTick();
|
await nextTick();
|
||||||
@ -228,10 +233,13 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
|
|||||||
other?: boolean
|
other?: boolean
|
||||||
): void => {
|
): void => {
|
||||||
if (other) {
|
if (other) {
|
||||||
useMultiTagsStoreHook().handleTags("equal", [
|
useMultiTagsStoreHook().handleTags(
|
||||||
VITE_HIDE_HOME === "false" ? routerArrays[0] : toRaw(getTopMenu()),
|
"equal",
|
||||||
obj
|
[
|
||||||
]);
|
VITE_HIDE_HOME === "false" ? fixedTags : toRaw(getTopMenu()),
|
||||||
|
obj
|
||||||
|
].flat()
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
useMultiTagsStoreHook().handleTags("splice", "", {
|
useMultiTagsStoreHook().handleTags("splice", "", {
|
||||||
startIndex,
|
startIndex,
|
||||||
@ -244,7 +252,7 @@ function deleteDynamicTag(obj: any, current: any, tag?: string) {
|
|||||||
if (tag === "other") {
|
if (tag === "other") {
|
||||||
spliceRoute(1, 1, true);
|
spliceRoute(1, 1, true);
|
||||||
} else if (tag === "left") {
|
} else if (tag === "left") {
|
||||||
spliceRoute(1, valueIndex - 1);
|
spliceRoute(fixedTags.length, valueIndex - 1, true);
|
||||||
} else if (tag === "right") {
|
} else if (tag === "right") {
|
||||||
spliceRoute(valueIndex + 1, multiTags.value.length);
|
spliceRoute(valueIndex + 1, multiTags.value.length);
|
||||||
} else {
|
} else {
|
||||||
@ -321,10 +329,11 @@ function onClickDrop(key, item, selectRoute?: RouteConfigs) {
|
|||||||
case 5:
|
case 5:
|
||||||
// 关闭全部标签页
|
// 关闭全部标签页
|
||||||
useMultiTagsStoreHook().handleTags("splice", "", {
|
useMultiTagsStoreHook().handleTags("splice", "", {
|
||||||
startIndex: 1,
|
startIndex: fixedTags.length,
|
||||||
length: multiTags.value.length
|
length: multiTags.value.length
|
||||||
});
|
});
|
||||||
router.push(topPath);
|
router.push(topPath);
|
||||||
|
// router.push(fixedTags[fixedTags.length - 1]?.path);
|
||||||
handleAliveRoute(route as ToRouteType);
|
handleAliveRoute(route as ToRouteType);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
@ -363,10 +372,14 @@ function showMenus(value: boolean) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function disabledMenus(value: boolean) {
|
function disabledMenus(value: boolean, fixedTag = false) {
|
||||||
Array.of(1, 2, 3, 4, 5).forEach(v => {
|
Array.of(1, 2, 3, 4, 5).forEach(v => {
|
||||||
tagsViews[v].disabled = value;
|
tagsViews[v].disabled = value;
|
||||||
});
|
});
|
||||||
|
if (fixedTag) {
|
||||||
|
tagsViews[2].show = false;
|
||||||
|
tagsViews[2].disabled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 检查当前右键的菜单两边是否存在别的菜单,如果左侧的菜单是顶级菜单,则不显示关闭左侧标签页,如果右侧没有菜单,则不显示关闭右侧标签页 */
|
/** 检查当前右键的菜单两边是否存在别的菜单,如果左侧的菜单是顶级菜单,则不显示关闭左侧标签页,如果右侧没有菜单,则不显示关闭右侧标签页 */
|
||||||
@ -383,6 +396,13 @@ function showMenuModel(
|
|||||||
} else {
|
} else {
|
||||||
currentIndex = allRoute.findIndex(v => isEqual(v.query, query));
|
currentIndex = allRoute.findIndex(v => isEqual(v.query, query));
|
||||||
}
|
}
|
||||||
|
function fixedTagDisabled() {
|
||||||
|
if (allRoute[currentIndex]?.meta?.fixedTag) {
|
||||||
|
Array.of(1, 2, 3, 4, 5).forEach(v => {
|
||||||
|
tagsViews[v].disabled = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
showMenus(true);
|
showMenus(true);
|
||||||
|
|
||||||
@ -401,6 +421,7 @@ function showMenuModel(
|
|||||||
tagsViews[v].disabled = false;
|
tagsViews[v].disabled = false;
|
||||||
});
|
});
|
||||||
tagsViews[2].disabled = true;
|
tagsViews[2].disabled = true;
|
||||||
|
fixedTagDisabled();
|
||||||
} else if (currentIndex === 1 && routeLength === 2) {
|
} else if (currentIndex === 1 && routeLength === 2) {
|
||||||
disabledMenus(false);
|
disabledMenus(false);
|
||||||
// 左侧的菜单是顶级菜单,右侧不存在别的菜单
|
// 左侧的菜单是顶级菜单,右侧不存在别的菜单
|
||||||
@ -408,6 +429,7 @@ function showMenuModel(
|
|||||||
tagsViews[v].show = false;
|
tagsViews[v].show = false;
|
||||||
tagsViews[v].disabled = true;
|
tagsViews[v].disabled = true;
|
||||||
});
|
});
|
||||||
|
fixedTagDisabled();
|
||||||
} else if (routeLength - 1 === currentIndex && currentIndex !== 0) {
|
} else if (routeLength - 1 === currentIndex && currentIndex !== 0) {
|
||||||
// 当前路由是所有路由中的最后一个
|
// 当前路由是所有路由中的最后一个
|
||||||
tagsViews[3].show = false;
|
tagsViews[3].show = false;
|
||||||
@ -415,18 +437,24 @@ function showMenuModel(
|
|||||||
tagsViews[v].disabled = false;
|
tagsViews[v].disabled = false;
|
||||||
});
|
});
|
||||||
tagsViews[3].disabled = true;
|
tagsViews[3].disabled = true;
|
||||||
|
if (allRoute[currentIndex - 1]?.meta?.fixedTag) {
|
||||||
|
tagsViews[2].show = false;
|
||||||
|
tagsViews[2].disabled = true;
|
||||||
|
}
|
||||||
|
fixedTagDisabled();
|
||||||
} else if (currentIndex === 0 || currentPath === `/redirect${topPath}`) {
|
} else if (currentIndex === 0 || currentPath === `/redirect${topPath}`) {
|
||||||
// 当前路由为顶级菜单
|
// 当前路由为顶级菜单
|
||||||
disabledMenus(true);
|
disabledMenus(true);
|
||||||
} else {
|
} else {
|
||||||
disabledMenus(false);
|
disabledMenus(false, allRoute[currentIndex - 1]?.meta?.fixedTag);
|
||||||
|
fixedTagDisabled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function openMenu(tag, e) {
|
function openMenu(tag, e) {
|
||||||
closeMenu();
|
closeMenu();
|
||||||
if (tag.path === topPath) {
|
if (tag.path === topPath || tag?.meta?.fixedTag) {
|
||||||
// 右键菜单为顶级菜单,只显示刷新
|
// 右键菜单为顶级菜单或拥有 fixedTag 属性,只显示刷新
|
||||||
showMenus(false);
|
showMenus(false);
|
||||||
tagsViews[0].show = true;
|
tagsViews[0].show = true;
|
||||||
} else if (route.path !== tag.path && route.name !== tag.name) {
|
} else if (route.path !== tag.path && route.name !== tag.name) {
|
||||||
@ -485,7 +513,6 @@ function tagOnClick(item) {
|
|||||||
} else {
|
} else {
|
||||||
router.push({ path });
|
router.push({ path });
|
||||||
}
|
}
|
||||||
// showMenuModel(item?.path, item?.query);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onClickOutside(contextmenuRef, closeMenu, {
|
onClickOutside(contextmenuRef, closeMenu, {
|
||||||
@ -549,7 +576,11 @@ onBeforeUnmount(() => {
|
|||||||
v-for="(item, index) in multiTags"
|
v-for="(item, index) in multiTags"
|
||||||
:ref="'dynamic' + index"
|
:ref="'dynamic' + index"
|
||||||
:key="index"
|
:key="index"
|
||||||
:class="['scroll-item is-closable', linkIsActive(item)]"
|
:class="[
|
||||||
|
'scroll-item is-closable',
|
||||||
|
linkIsActive(item),
|
||||||
|
!isAllEmpty(item?.meta?.fixedTag) && 'fixed-tag'
|
||||||
|
]"
|
||||||
@contextmenu.prevent="openMenu(item, $event)"
|
@contextmenu.prevent="openMenu(item, $event)"
|
||||||
@mouseenter.prevent="onMouseenter(index)"
|
@mouseenter.prevent="onMouseenter(index)"
|
||||||
@mouseleave.prevent="onMouseleave(index)"
|
@mouseleave.prevent="onMouseleave(index)"
|
||||||
@ -562,8 +593,10 @@ onBeforeUnmount(() => {
|
|||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
v-if="
|
v-if="
|
||||||
iconIsActive(item, index) ||
|
isAllEmpty(item?.meta?.fixedTag)
|
||||||
(index === activeIndex && index !== 0)
|
? iconIsActive(item, index) ||
|
||||||
|
(index === activeIndex && index !== 0)
|
||||||
|
: false
|
||||||
"
|
"
|
||||||
class="el-icon-close"
|
class="el-icon-close"
|
||||||
@click.stop="deleteMenu(item)"
|
@click.stop="deleteMenu(item)"
|
||||||
|
@ -17,9 +17,9 @@ import {
|
|||||||
isIncludeAllChildren
|
isIncludeAllChildren
|
||||||
} from "@pureadmin/utils";
|
} from "@pureadmin/utils";
|
||||||
import { getConfig } from "@/config";
|
import { getConfig } from "@/config";
|
||||||
import type { menuType } from "@/layout/types";
|
|
||||||
import { buildHierarchyTree } from "@/utils/tree";
|
import { buildHierarchyTree } from "@/utils/tree";
|
||||||
import { userKey, type DataInfo } from "@/utils/auth";
|
import { userKey, type DataInfo } from "@/utils/auth";
|
||||||
|
import { type menuType, routerArrays } from "@/layout/types";
|
||||||
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
import { useMultiTagsStoreHook } from "@/store/modules/multiTags";
|
||||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||||
const IFrame = () => import("@/layout/frameView.vue");
|
const IFrame = () => import("@/layout/frameView.vue");
|
||||||
@ -178,6 +178,14 @@ function handleAsyncRoutes(routeList) {
|
|||||||
);
|
);
|
||||||
usePermissionStoreHook().handleWholeMenus(routeList);
|
usePermissionStoreHook().handleWholeMenus(routeList);
|
||||||
}
|
}
|
||||||
|
if (!useMultiTagsStoreHook().getMultiTagsCache) {
|
||||||
|
useMultiTagsStoreHook().handleTags("equal", [
|
||||||
|
...routerArrays,
|
||||||
|
...usePermissionStoreHook().flatteningRoutes.filter(
|
||||||
|
v => v?.meta?.fixedTag
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
}
|
||||||
addPathMatch();
|
addPathMatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { store } from "@/store";
|
import { store } from "@/store";
|
||||||
import { routerArrays } from "@/layout/types";
|
import { routerArrays } from "@/layout/types";
|
||||||
|
import { usePermissionStoreHook } from "./permission";
|
||||||
import { responsiveStorageNameSpace } from "@/config";
|
import { responsiveStorageNameSpace } from "@/config";
|
||||||
import type { multiType, positionType } from "./types";
|
import type { multiType, positionType } from "./types";
|
||||||
import { isEqual, isBoolean, isUrl, storageLocal } from "@pureadmin/utils";
|
import { isEqual, isBoolean, isUrl, storageLocal } from "@pureadmin/utils";
|
||||||
@ -15,7 +16,12 @@ export const useMultiTagsStore = defineStore({
|
|||||||
? storageLocal().getItem<StorageConfigs>(
|
? storageLocal().getItem<StorageConfigs>(
|
||||||
`${responsiveStorageNameSpace()}tags`
|
`${responsiveStorageNameSpace()}tags`
|
||||||
)
|
)
|
||||||
: [...routerArrays],
|
: [
|
||||||
|
...routerArrays,
|
||||||
|
...usePermissionStoreHook().flatteningRoutes.filter(
|
||||||
|
v => v?.meta?.fixedTag
|
||||||
|
)
|
||||||
|
],
|
||||||
multiTagsCache: storageLocal().getItem<StorageConfigs>(
|
multiTagsCache: storageLocal().getItem<StorageConfigs>(
|
||||||
`${responsiveStorageNameSpace()}configure`
|
`${responsiveStorageNameSpace()}configure`
|
||||||
)?.multiTagsCache
|
)?.multiTagsCache
|
||||||
|
@ -4,7 +4,12 @@ import type { cacheType } from "./types";
|
|||||||
import { constantMenus } from "@/router";
|
import { constantMenus } from "@/router";
|
||||||
import { useMultiTagsStoreHook } from "./multiTags";
|
import { useMultiTagsStoreHook } from "./multiTags";
|
||||||
import { debounce, getKeyList } from "@pureadmin/utils";
|
import { debounce, getKeyList } from "@pureadmin/utils";
|
||||||
import { ascending, filterTree, filterNoPermissionTree } from "@/router/utils";
|
import {
|
||||||
|
ascending,
|
||||||
|
filterTree,
|
||||||
|
filterNoPermissionTree,
|
||||||
|
formatFlatteningRoutes
|
||||||
|
} from "@/router/utils";
|
||||||
|
|
||||||
export const usePermissionStore = defineStore({
|
export const usePermissionStore = defineStore({
|
||||||
id: "pure-permission",
|
id: "pure-permission",
|
||||||
@ -13,6 +18,8 @@ export const usePermissionStore = defineStore({
|
|||||||
constantMenus,
|
constantMenus,
|
||||||
// 整体路由生成的菜单(静态、动态)
|
// 整体路由生成的菜单(静态、动态)
|
||||||
wholeMenus: [],
|
wholeMenus: [],
|
||||||
|
// 整体路由(一维数组格式)
|
||||||
|
flatteningRoutes: [],
|
||||||
// 缓存页面keepAlive
|
// 缓存页面keepAlive
|
||||||
cachePageList: []
|
cachePageList: []
|
||||||
}),
|
}),
|
||||||
@ -22,6 +29,9 @@ export const usePermissionStore = defineStore({
|
|||||||
this.wholeMenus = filterNoPermissionTree(
|
this.wholeMenus = filterNoPermissionTree(
|
||||||
filterTree(ascending(this.constantMenus.concat(routes)))
|
filterTree(ascending(this.constantMenus.concat(routes)))
|
||||||
);
|
);
|
||||||
|
this.flatteningRoutes = formatFlatteningRoutes(
|
||||||
|
this.constantMenus.concat(routes)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
cacheOperate({ mode, name }: cacheType) {
|
cacheOperate({ mode, name }: cacheType) {
|
||||||
const delIndex = this.cachePageList.findIndex(v => v === name);
|
const delIndex = this.cachePageList.findIndex(v => v === name);
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
| `frameLoading` | 加载动画(内嵌的`iframe`页面是否开启首次加载动画) |
|
| `frameLoading` | 加载动画(内嵌的`iframe`页面是否开启首次加载动画) |
|
||||||
| `keepAlive` | 缓存页面(是否缓存该路由页面,开启后会保存该页面的整体状态,刷新后会清空状态) |
|
| `keepAlive` | 缓存页面(是否缓存该路由页面,开启后会保存该页面的整体状态,刷新后会清空状态) |
|
||||||
| `hiddenTag` | 标签页(当前菜单名称或自定义信息禁止添加到标签页) |
|
| `hiddenTag` | 标签页(当前菜单名称或自定义信息禁止添加到标签页) |
|
||||||
|
| `fixedTag` | 固定标签页(当前菜单名称是否固定显示在标签页且不可关闭) |
|
||||||
| `showLink` | 菜单(是否显示该菜单) |
|
| `showLink` | 菜单(是否显示该菜单) |
|
||||||
| `showParent` | 父级菜单(是否显示父级菜单 [点击查看更多](https://yiming_chang.gitee.io/pure-admin-doc/pages/routerMenu/#%E7%AC%AC%E4%B8%80%E7%A7%8D-%E8%AF%A5%E6%A8%A1%E5%BC%8F%E9%92%88%E5%AF%B9%E7%88%B6%E7%BA%A7%E8%8F%9C%E5%8D%95%E4%B8%8B%E5%8F%AA%E6%9C%89%E4%B8%80%E4%B8%AA%E5%AD%90%E8%8F%9C%E5%8D%95%E7%9A%84%E6%83%85%E5%86%B5-%E5%9C%A8%E5%AD%90%E8%8F%9C%E5%8D%95%E7%9A%84-meta-%E5%B1%9E%E6%80%A7%E4%B8%AD%E5%8A%A0%E4%B8%8A-showparent-true-%E5%8D%B3%E5%8F%AF)) |
|
| `showParent` | 父级菜单(是否显示父级菜单 [点击查看更多](https://yiming_chang.gitee.io/pure-admin-doc/pages/routerMenu/#%E7%AC%AC%E4%B8%80%E7%A7%8D-%E8%AF%A5%E6%A8%A1%E5%BC%8F%E9%92%88%E5%AF%B9%E7%88%B6%E7%BA%A7%E8%8F%9C%E5%8D%95%E4%B8%8B%E5%8F%AA%E6%9C%89%E4%B8%80%E4%B8%AA%E5%AD%90%E8%8F%9C%E5%8D%95%E7%9A%84%E6%83%85%E5%86%B5-%E5%9C%A8%E5%AD%90%E8%8F%9C%E5%8D%95%E7%9A%84-meta-%E5%B1%9E%E6%80%A7%E4%B8%AD%E5%8A%A0%E4%B8%8A-showparent-true-%E5%8D%B3%E5%8F%AF)) |
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import ReAnimateSelector from "@/components/ReAnimateSelector";
|
|||||||
import {
|
import {
|
||||||
menuTypeOptions,
|
menuTypeOptions,
|
||||||
showLinkOptions,
|
showLinkOptions,
|
||||||
|
fixedTagOptions,
|
||||||
keepAliveOptions,
|
keepAliveOptions,
|
||||||
hiddenTagOptions,
|
hiddenTagOptions,
|
||||||
showParentOptions,
|
showParentOptions,
|
||||||
@ -37,6 +38,7 @@ const props = withDefaults(defineProps<FormProps>(), {
|
|||||||
frameLoading: true,
|
frameLoading: true,
|
||||||
keepAlive: false,
|
keepAlive: false,
|
||||||
hiddenTag: false,
|
hiddenTag: false,
|
||||||
|
fixedTag: false,
|
||||||
showLink: true,
|
showLink: true,
|
||||||
showParent: false
|
showParent: false
|
||||||
})
|
})
|
||||||
@ -258,33 +260,6 @@ defineExpose({ getRef });
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</re-col>
|
</re-col>
|
||||||
|
|
||||||
<re-col v-show="newFormInline.menuType < 2" :value="12" :xs="24" :sm="24">
|
|
||||||
<el-form-item label="缓存页面">
|
|
||||||
<Segmented
|
|
||||||
:modelValue="newFormInline.keepAlive ? 0 : 1"
|
|
||||||
:options="keepAliveOptions"
|
|
||||||
@change="
|
|
||||||
({ option: { value } }) => {
|
|
||||||
newFormInline.keepAlive = value;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</re-col>
|
|
||||||
<re-col v-show="newFormInline.menuType < 2" :value="12" :xs="24" :sm="24">
|
|
||||||
<el-form-item label="标签页">
|
|
||||||
<Segmented
|
|
||||||
:modelValue="newFormInline.hiddenTag ? 1 : 0"
|
|
||||||
:options="hiddenTagOptions"
|
|
||||||
@change="
|
|
||||||
({ option: { value } }) => {
|
|
||||||
newFormInline.hiddenTag = value;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</re-col>
|
|
||||||
|
|
||||||
<re-col
|
<re-col
|
||||||
v-show="newFormInline.menuType !== 3"
|
v-show="newFormInline.menuType !== 3"
|
||||||
:value="12"
|
:value="12"
|
||||||
@ -305,7 +280,7 @@ defineExpose({ getRef });
|
|||||||
</re-col>
|
</re-col>
|
||||||
<re-col
|
<re-col
|
||||||
v-show="newFormInline.menuType !== 3"
|
v-show="newFormInline.menuType !== 3"
|
||||||
:value="8"
|
:value="12"
|
||||||
:xs="24"
|
:xs="24"
|
||||||
:sm="24"
|
:sm="24"
|
||||||
>
|
>
|
||||||
@ -321,6 +296,47 @@ defineExpose({ getRef });
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</re-col>
|
</re-col>
|
||||||
|
|
||||||
|
<re-col v-show="newFormInline.menuType < 2" :value="12" :xs="24" :sm="24">
|
||||||
|
<el-form-item label="缓存页面">
|
||||||
|
<Segmented
|
||||||
|
:modelValue="newFormInline.keepAlive ? 0 : 1"
|
||||||
|
:options="keepAliveOptions"
|
||||||
|
@change="
|
||||||
|
({ option: { value } }) => {
|
||||||
|
newFormInline.keepAlive = value;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</re-col>
|
||||||
|
|
||||||
|
<re-col v-show="newFormInline.menuType < 2" :value="12" :xs="24" :sm="24">
|
||||||
|
<el-form-item label="标签页">
|
||||||
|
<Segmented
|
||||||
|
:modelValue="newFormInline.hiddenTag ? 1 : 0"
|
||||||
|
:options="hiddenTagOptions"
|
||||||
|
@change="
|
||||||
|
({ option: { value } }) => {
|
||||||
|
newFormInline.hiddenTag = value;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</re-col>
|
||||||
|
<re-col v-show="newFormInline.menuType < 2" :value="12" :xs="24" :sm="24">
|
||||||
|
<el-form-item label="固定标签页">
|
||||||
|
<Segmented
|
||||||
|
:modelValue="newFormInline.fixedTag ? 0 : 1"
|
||||||
|
:options="fixedTagOptions"
|
||||||
|
@change="
|
||||||
|
({ option: { value } }) => {
|
||||||
|
newFormInline.fixedTag = value;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</re-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
|
@ -32,6 +32,19 @@ const showLinkOptions: Array<OptionsType> = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const fixedTagOptions: Array<OptionsType> = [
|
||||||
|
{
|
||||||
|
label: "固定",
|
||||||
|
tip: "当前菜单名称固定显示在标签页且不可关闭",
|
||||||
|
value: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "不固定",
|
||||||
|
tip: "当前菜单名称不固定显示在标签页且可关闭",
|
||||||
|
value: false
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
const keepAliveOptions: Array<OptionsType> = [
|
const keepAliveOptions: Array<OptionsType> = [
|
||||||
{
|
{
|
||||||
label: "缓存",
|
label: "缓存",
|
||||||
@ -87,6 +100,7 @@ const frameLoadingOptions: Array<OptionsType> = [
|
|||||||
export {
|
export {
|
||||||
menuTypeOptions,
|
menuTypeOptions,
|
||||||
showLinkOptions,
|
showLinkOptions,
|
||||||
|
fixedTagOptions,
|
||||||
keepAliveOptions,
|
keepAliveOptions,
|
||||||
hiddenTagOptions,
|
hiddenTagOptions,
|
||||||
showParentOptions,
|
showParentOptions,
|
||||||
|
@ -155,6 +155,7 @@ export function useMenu() {
|
|||||||
frameLoading: row?.frameLoading ?? true,
|
frameLoading: row?.frameLoading ?? true,
|
||||||
keepAlive: row?.keepAlive ?? false,
|
keepAlive: row?.keepAlive ?? false,
|
||||||
hiddenTag: row?.hiddenTag ?? false,
|
hiddenTag: row?.hiddenTag ?? false,
|
||||||
|
fixedTag: row?.fixedTag ?? false,
|
||||||
showLink: row?.showLink ?? true,
|
showLink: row?.showLink ?? true,
|
||||||
showParent: row?.showParent ?? false
|
showParent: row?.showParent ?? false
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ interface FormItemProps {
|
|||||||
frameLoading: boolean;
|
frameLoading: boolean;
|
||||||
keepAlive: boolean;
|
keepAlive: boolean;
|
||||||
hiddenTag: boolean;
|
hiddenTag: boolean;
|
||||||
|
fixedTag: boolean;
|
||||||
showLink: boolean;
|
showLink: boolean;
|
||||||
showParent: boolean;
|
showParent: boolean;
|
||||||
}
|
}
|
||||||
|
4
types/router.d.ts
vendored
4
types/router.d.ts
vendored
@ -45,8 +45,10 @@ declare global {
|
|||||||
/** 离场动画 */
|
/** 离场动画 */
|
||||||
leaveTransition?: string;
|
leaveTransition?: string;
|
||||||
};
|
};
|
||||||
// 是否不添加信息到标签页,(默认`false`)
|
/** 当前菜单名称或自定义信息禁止添加到标签页(默认`false`) */
|
||||||
hiddenTag?: boolean;
|
hiddenTag?: boolean;
|
||||||
|
/** 当前菜单名称是否固定显示在标签页且不可关闭(默认`false`) */
|
||||||
|
fixedTag?: boolean;
|
||||||
/** 动态路由可打开的最大数量 `可选` */
|
/** 动态路由可打开的最大数量 `可选` */
|
||||||
dynamicLevel?: number;
|
dynamicLevel?: number;
|
||||||
/** 将某个菜单激活
|
/** 将某个菜单激活
|
||||||
|
Loading…
x
Reference in New Issue
Block a user