Commit 54c2b284 authored by Pan's avatar Pan

fix[ExternalLink]: fixed bug when url include chinese

parent 8c0668d0
...@@ -68,3 +68,7 @@ export function formatTime(time, option) { ...@@ -68,3 +68,7 @@ export function formatTime(time, option) {
) )
} }
} }
export function isExternal(path) {
return /^(https?:|mailto:|tel:)/.test(path)
}
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</template> </template>
<script> <script>
import { validateURL } from '@/utils/validate' import { isExternal } from '@/utils'
export default { export default {
props: { props: {
...@@ -18,7 +18,7 @@ export default { ...@@ -18,7 +18,7 @@ export default {
}, },
methods: { methods: {
isExternalLink(routePath) { isExternalLink(routePath) {
return validateURL(routePath) return isExternal(routePath)
}, },
linkProps(url) { linkProps(url) {
if (this.isExternalLink(url)) { if (this.isExternalLink(url)) {
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<script> <script>
import path from 'path' import path from 'path'
import { validateURL } from '@/utils/validate' import { isExternal } from '@/utils'
import Item from './Item' import Item from './Item'
import AppLink from './Link' import AppLink from './Link'
...@@ -94,7 +94,7 @@ export default { ...@@ -94,7 +94,7 @@ export default {
return path.resolve(this.basePath, routePath) return path.resolve(this.basePath, routePath)
}, },
isExternalLink(routePath) { isExternalLink(routePath) {
return validateURL(routePath) return isExternal(routePath)
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment