Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pro-layout
Project
Project
Details
Activity
Releases
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
packages
pro-layout
Commits
22a3bf34
Commit
22a3bf34
authored
Nov 26, 2020
by
Sendya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: remote path | target not work
parent
da2392e8
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28327 additions
and
4 deletions
+28327
-4
router.config.js
examples/src/config/router.config.js
+9
-0
index.js
examples/src/router/index.js
+1
-1
yarn.lock
examples/yarn.lock
+10858
-0
BaseMenu.jsx
src/components/RouteMenu/BaseMenu.jsx
+9
-3
yarn.lock
yarn.lock
+17450
-0
No files found.
examples/src/config/router.config.js
View file @
22a3bf34
...
...
@@ -115,6 +115,15 @@ const asyncRouterMap = [
icon
:
'smile'
},
component
:
()
=>
import
(
/* webpackChunkName: "about" */
'../views/TestPage3'
)
},
{
path
:
'http://www.baidu.com/'
,
name
:
'remote-baidu'
,
meta
:
{
title
:
'百度'
,
icon
:
'smile'
,
target
:
'_blank'
}
}
]
}
...
...
examples/src/router/index.js
View file @
22a3bf34
...
...
@@ -20,7 +20,7 @@ Vue.use(VueRouter)
const
routes
=
asyncRouterMap
const
router
=
new
VueRouter
({
mode
:
'h
istory
'
,
mode
:
'h
ash
'
,
routes
})
...
...
examples/yarn.lock
0 → 100644
View file @
22a3bf34
This diff is collapsed.
Click to expand it.
src/components/RouteMenu/BaseMenu.jsx
View file @
22a3bf34
...
...
@@ -18,6 +18,8 @@ export const RouteMenuProps = {
i18nRender
:
PropTypes
.
oneOfType
([
PropTypes
.
func
,
PropTypes
.
bool
]).
def
(
false
),
}
const
httpReg
=
/
(
http|https|ftp
)
:
\/\/([\w
.
]
+
\/?)\S
*/
const
renderMenu
=
(
h
,
item
,
i18nRender
)
=>
{
if
(
item
&&
!
item
.
hidden
)
{
const
bool
=
item
.
children
&&
!
item
.
hideChildrenInMenu
...
...
@@ -42,9 +44,10 @@ const renderSubMenu = (h, item, i18nRender) => {
const
renderMenuItem
=
(
h
,
item
,
i18nRender
)
=>
{
const
meta
=
Object
.
assign
({},
item
.
meta
)
const
target
=
meta
.
target
||
null
const
hasRemoteUrl
=
httpReg
.
test
(
item
.
path
)
const
CustomTag
=
target
&&
'a'
||
'router-link'
const
props
=
{
to
:
{
name
:
item
.
name
}
}
const
attrs
=
{
href
:
item
.
path
,
target
:
target
}
const
attrs
=
(
hasRemoteUrl
||
target
)
?
{
href
:
item
.
path
,
target
:
target
}
:
{
}
if
(
item
.
children
&&
item
.
hideChildrenInMenu
)
{
// 把有子菜单的 并且 父菜单是要隐藏子菜单的
// 都给子菜单增加一个 hidden 属性
...
...
@@ -83,7 +86,8 @@ const RouteMenu = {
return
{
openKeys
:
[],
selectedKeys
:
[],
cachedOpenKeys
:
[]
cachedOpenKeys
:
[],
cachedSelectedKeys
:
[],
}
},
render
(
h
)
{
...
...
@@ -111,8 +115,10 @@ const RouteMenu = {
},
on
:
{
select
:
menu
=>
{
this
.
selectedKeys
=
menu
.
selectedKeys
this
.
$emit
(
'select'
,
menu
)
if
(
!
httpReg
.
test
(
menu
.
key
))
{
this
.
selectedKeys
=
menu
.
selectedKeys
}
},
openChange
:
handleOpenChange
}
...
...
yarn.lock
0 → 100644
View file @
22a3bf34
This diff is collapsed.
Click to expand it.
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