diff --git a/lib/default-theme/NavLink.vue b/lib/default-theme/NavLink.vue index 63104cce26..c172e37520 100644 --- a/lib/default-theme/NavLink.vue +++ b/lib/default-theme/NavLink.vue @@ -9,13 +9,13 @@ v-else :href="link" class="nav-link" - :target="isMailto(link) ? null : '_blank'" - :rel="isMailto(link) ? null : 'noopener noreferrer'" + :target="isMailto(link) || isTel(link) ? null : '_blank'" + :rel="isMailto(link) || isTel(link) ? null : 'noopener noreferrer'" >{{ item.text }} diff --git a/lib/default-theme/util.js b/lib/default-theme/util.js index 5aafb431bb..22192591bb 100644 --- a/lib/default-theme/util.js +++ b/lib/default-theme/util.js @@ -1,7 +1,7 @@ export const hashRE = /#.*$/ export const extRE = /\.(md|html)$/ export const endingSlashRE = /\/$/ -export const outboundRE = /^(https?:|mailto:)/ +export const outboundRE = /^(https?:|mailto:|tel:)/ export function normalize (path) { return path @@ -24,6 +24,10 @@ export function isMailto (path) { return /^mailto:/.test(path) } +export function isTel (path) { + return /^tel:/.test(path) +} + export function ensureExt (path) { if (isExternal(path)) { return path