提交 1efa9cfa 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

fix route item title issue

上级 882c0d0a
{
"name": "admin-antd-vue",
"description": "Vue3.x Antd Admin",
"name": "ZTF",
"description": "Zentao Test Framework",
"version": "1.0.0",
"private": true,
"scripts": {
......
......@@ -2,7 +2,6 @@ import { RoutesDataItem } from "@/utils/routes";
/**
* 站点配置
* @author LiQingSong
*/
export interface SettingsType {
/**
......
......@@ -89,6 +89,9 @@ import { equalObject } from "./object";
* @param routesData routes
*/
export const getRouteItem = (pathname: string, routesData: RoutesDataItem[]): RoutesDataItem => {
console.log('getRouteItem', getRouteItem)
let item: RoutesDataItem = { title: '', path: '', redirect: '', roles: [] };
for (let index = 0, len = routesData.length; index < len; index += 1) {
......@@ -98,8 +101,8 @@ export const getRouteItem = (pathname: string, routesData: RoutesDataItem[]): Ro
item = element;
break;
} else if (element.path.indexOf(':') > 0) {
const reg = new RegExp("((.+)(:[^/]+)(.*))","gmi");
const path = element.path.replace(reg,"$2.+$4")
const reg = new RegExp("(:[^/]+)","gmi");
const path = element.path.replaceAll(reg,".+")
const pass = new RegExp(path).test(pathname)
if (pass) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册