File tree 1 file changed +18
-8
lines changed
1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<nav class =" nav-links" v-if =" userLinks.length || githubLink" >
3
3
<!-- user links -->
4
- <router-link v-for =" item in userLinks"
5
- :to =" item.link"
6
- :key =" item.link"
7
- :exact =" item.link === '/'" >
8
- {{ item.text }}
9
- </router-link >
4
+ <template v-for =" item in userLinks " >
5
+ <a v-if =" item.isOutbound"
6
+ :href =" item.link"
7
+ target =" _blank"
8
+ rel =" noopener noreferrer" >
9
+ {{ item.text }}
10
+ </a >
11
+ <router-link
12
+ v-else
13
+ :to =" item.link"
14
+ :key =" item.link"
15
+ :exact =" item.link === '/'" >
16
+ {{ item.text }}
17
+ </router-link >
18
+ </template >
10
19
<!-- github link -->
11
20
<a v-if =" githubLink"
12
21
:href =" githubLink"
21
30
22
31
<script >
23
32
import OutboundLink from ' ./OutboundLink.vue'
24
- import { isActive , ensureExt } from ' ./util'
33
+ import { isActive , ensureExt , outboundRE } from ' ./util'
25
34
26
35
export default {
27
36
components: { OutboundLink },
28
37
computed: {
29
38
userLinks () {
30
39
return (this .$site .themeConfig .nav || []).map (item => ({
31
40
text: item .text ,
32
- link: ensureExt (item .link )
41
+ link: ensureExt (item .link ),
42
+ isOutbound: outboundRE .test (item .link )
33
43
}))
34
44
},
35
45
githubLink () {
You can’t perform that action at this time.
0 commit comments