File tree 3 files changed +8
-4
lines changed
3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -296,3 +296,7 @@ export function deepClone(source) {
296
296
export function uniqueArr ( arr ) {
297
297
return Array . from ( new Set ( arr ) )
298
298
}
299
+
300
+ export function isExternal ( path ) {
301
+ return / ^ ( h t t p s ? : | m a i l t o : | t e l : ) / . test ( path )
302
+ }
Original file line number Diff line number Diff line change 7
7
</template >
8
8
9
9
<script >
10
- import { validateURL } from ' @/utils/validate '
10
+ import { isExternal } from ' @/utils'
11
11
12
12
export default {
13
13
props: {
@@ -18,7 +18,7 @@ export default {
18
18
},
19
19
methods: {
20
20
isExternalLink (routePath ) {
21
- return validateURL (routePath)
21
+ return isExternal (routePath)
22
22
},
23
23
linkProps (url ) {
24
24
if (this .isExternalLink (url)) {
Original file line number Diff line number Diff line change 37
37
<script >
38
38
import path from ' path'
39
39
import { generateTitle } from ' @/utils/i18n'
40
- import { validateURL } from ' @/utils/validate '
40
+ import { isExternal } from ' @/utils'
41
41
import Item from ' ./Item'
42
42
import AppLink from ' ./Link'
43
43
import FixiOSBug from ' ./FixiOSBug'
@@ -98,7 +98,7 @@ export default {
98
98
return path .resolve (this .basePath , routePath)
99
99
},
100
100
isExternalLink (routePath ) {
101
- return validateURL (routePath)
101
+ return isExternal (routePath)
102
102
},
103
103
generateTitle
104
104
}
You can’t perform that action at this time.
0 commit comments