fix[ExternalLink]: fixed bug when url include chinese
This commit is contained in:
parent
8c0668d0d3
commit
54c2b2848e
|
@ -68,3 +68,7 @@ export function formatTime(time, option) {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
export function isExternal(path) {
|
||||
return /^(https?:|mailto:|tel:)/.test(path)
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { validateURL } from '@/utils/validate'
|
||||
import { isExternal } from '@/utils'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
|
@ -18,7 +18,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
isExternalLink(routePath) {
|
||||
return validateURL(routePath)
|
||||
return isExternal(routePath)
|
||||
},
|
||||
linkProps(url) {
|
||||
if (this.isExternalLink(url)) {
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
<script>
|
||||
import path from 'path'
|
||||
import { validateURL } from '@/utils/validate'
|
||||
import { isExternal } from '@/utils'
|
||||
import Item from './Item'
|
||||
import AppLink from './Link'
|
||||
|
||||
|
@ -94,7 +94,7 @@ export default {
|
|||
return path.resolve(this.basePath, routePath)
|
||||
},
|
||||
isExternalLink(routePath) {
|
||||
return validateURL(routePath)
|
||||
return isExternal(routePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue