File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed
Expand file tree Collapse file tree 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) {
296296export function uniqueArr ( arr ) {
297297 return Array . from ( new Set ( arr ) )
298298}
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 77</template >
88
99<script >
10- import { validateURL } from ' @/utils/validate '
10+ import { isExternal } from ' @/utils'
1111
1212export default {
1313 props: {
@@ -18,7 +18,7 @@ export default {
1818 },
1919 methods: {
2020 isExternalLink (routePath ) {
21- return validateURL (routePath)
21+ return isExternal (routePath)
2222 },
2323 linkProps (url ) {
2424 if (this .isExternalLink (url)) {
Original file line number Diff line number Diff line change 3737<script >
3838import path from ' path'
3939import { generateTitle } from ' @/utils/i18n'
40- import { validateURL } from ' @/utils/validate '
40+ import { isExternal } from ' @/utils'
4141import Item from ' ./Item'
4242import AppLink from ' ./Link'
4343import FixiOSBug from ' ./FixiOSBug'
@@ -98,7 +98,7 @@ export default {
9898 return path .resolve (this .basePath , routePath)
9999 },
100100 isExternalLink (routePath ) {
101- return validateURL (routePath)
101+ return isExternal (routePath)
102102 },
103103 generateTitle
104104 }
You can’t perform that action at this time.
0 commit comments