From aff349a86361efabec4cd705321889dc37e274e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BD=98=E5=98=89=E6=99=A8?= Date: Thu, 4 Jun 2020 21:24:14 +0800 Subject: [PATCH] fix: compatibility with vetur https://github.com/PanJiaChen/vue-element-admin/commit/fc26c3106fefda7ff80afdc8bcad06f0b1ef2909 --- src/layout/components/Sidebar/Link.vue | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/layout/components/Sidebar/Link.vue b/src/layout/components/Sidebar/Link.vue index eb4dd10..530b3d5 100644 --- a/src/layout/components/Sidebar/Link.vue +++ b/src/layout/components/Sidebar/Link.vue @@ -1,7 +1,5 @@ - @@ -16,19 +14,28 @@ export default { required: true } }, + computed: { + isExternal() { + return isExternal(this.to) + }, + type() { + if (this.isExternal) { + return 'a' + } + return 'router-link' + } + }, methods: { - linkProps(url) { - if (isExternal(url)) { + linkProps(to) { + if (this.isExternal) { return { - is: 'a', - href: url, + href: to, target: '_blank', rel: 'noopener' } } return { - is: 'router-link', - to: url + to: to } } }