Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
RuoYi Vue
Commits
519ea854
Commit
519ea854
authored
Oct 15, 2021
by
RuoYi
Browse files
生产环境使用路由懒加载提升页面响应速度
parent
e66d0e4f
Changes
1
Hide whitespace changes
Inline
Side-by-side
ruoyi-ui/src/store/modules/permission.js
View file @
519ea854
...
@@ -106,8 +106,13 @@ function filterChildren(childrenMap, lastRouter = false) {
...
@@ -106,8 +106,13 @@ function filterChildren(childrenMap, lastRouter = false) {
return
children
return
children
}
}
export
const
loadView
=
(
view
)
=>
{
// 路由懒加载
export
const
loadView
=
(
view
)
=>
{
return
(
resolve
)
=>
require
([
`@/views/
${
view
}
`
],
resolve
)
if
(
process
.
env
.
NODE_ENV
===
'
development
'
)
{
return
(
resolve
)
=>
require
([
`@/views/
${
view
}
`
],
resolve
)
}
else
{
// 使用 import 实现生产环境的路由懒加载
return
()
=>
import
(
`@/views/
${
view
}
`
)
}
}
}
export
default
permission
export
default
permission
Write
Preview
Supports
Markdown
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