Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
W
web-monitor
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
web-monitor
Commits
54c2b284
Commit
54c2b284
authored
Oct 10, 2018
by
Pan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix[ExternalLink]: fixed bug when url include chinese
parent
8c0668d0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
index.js
src/utils/index.js
+4
-0
Link.vue
src/views/layout/components/Sidebar/Link.vue
+2
-2
SidebarItem.vue
src/views/layout/components/Sidebar/SidebarItem.vue
+2
-2
No files found.
src/utils/index.js
View file @
54c2b284
...
@@ -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
)
}
src/views/layout/components/Sidebar/Link.vue
View file @
54c2b284
...
@@ -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
))
{
...
...
src/views/layout/components/Sidebar/SidebarItem.vue
View file @
54c2b284
...
@@ -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
)
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment