From 4f29e832154fd1acf6e5ac207b66a11b24e87010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=85=88=E7=91=9E?= <1490493387@qq.com> Date: Fri, 18 Feb 2022 00:05:43 +0800 Subject: [PATCH] =?UTF-8?q?feat(Menu.vue):=20=E8=8F=9C=E5=8D=95=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E6=B7=BB=E5=8A=A0=E5=A4=96=E9=93=BE=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.ts | 11 +++++++++++ src/utils/validate.ts | 5 +++-- src/views/system/menu/components/Menu.vue | 21 ++++++++++++++++----- 3 files changed, 30 insertions(+), 7 deletions(-) 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() { // 重置父组件