diff --git a/src/router/index.ts b/src/router/index.ts index f5c0ac57..041f141e 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -44,6 +44,17 @@ export const constantRoutes: Array = [ } ] }, + // 外部链接 + /*{ + path: '/external-link', + component: Layout, + children: [ + { + path: 'https://www.cnblogs.com/haoxianrui/', + meta: { title: '外部链接', icon: 'link' } + } + ] + }*/ // 多级嵌套路由 /* { path: '/nested', diff --git a/src/utils/validate.ts b/src/utils/validate.ts index e35c2faf..19e07050 100644 --- a/src/utils/validate.ts +++ b/src/utils/validate.ts @@ -6,7 +6,8 @@ * @param {string} path * @returns {Boolean} */ -export function isExternal(path : string) { - return /^(https?:|mailto:|tel:)/.test(path) +export function isExternal(path: string) { + const isExternal = /^(https?:|http?:|mailto:|tel:)/.test(path) + return isExternal } diff --git a/src/views/system/menu/components/Menu.vue b/src/views/system/menu/components/Menu.vue index 00e47b10..3c814e11 100644 --- a/src/views/system/menu/components/Menu.vue +++ b/src/views/system/menu/components/Menu.vue @@ -104,10 +104,20 @@ - + + + + + + + + + + + + @@ -116,7 +126,7 @@ @@ -232,10 +242,11 @@ const state = reactive({ ] }, menuOptions: [] as any[], - currentRow: undefined + currentRow: undefined, + isExternal: false }) -const {loading, single, multiple, queryParams, menuList, total, dialog, formData, rules, menuOptions} = toRefs(state) +const {loading, single, multiple, queryParams, menuList, total, dialog, formData, rules, menuOptions,isExternal} = toRefs(state) function handleQuery() { // 重置父组件