问题描述
借用iview-admin框架写的一个项目,一开始是单页面的,现在需求原因,需要改为多页面形式。而之前的那套路由,报内存溢出的错误,直接没法调试。
问题出现的环境背景及自己尝试过哪些方法
现在是vue-cli3的版本。
相关代码
//vue.config.js 配置
const path = require('path')
const resolve = dir => {
return path.join(__dirname, dir)
}
const BASE_URL = process.env.NODE_ENV === 'production'
? '/iview/'
: '/'
module.exports = {
pages: {
index: {
// entry for the page
entry: 'src/main.js',
template: 'public/index.html',
// output as dist/index.html
filename: 'index.html',
chunks: ['sbupage']
},
sbupage: {
entry: 'src/sbupage/main.js',
// title: "main page",
template: 'public/subpage.html',
filename: 'sbupage.html',
}
},
baseUrl: BASE_URL,
lintOnSave: false,
chainWebpack: config => {
config.resolve.alias
.set('@', resolve('src'))
.set('_c', resolve('src/components'))
},
}
目录
相关的路由代码
{
path: '/userManagement',
name: 'userManagement',
meta: {
icon: 'md-person',
title: '用户管理'
},
component: Main,
children: [{
path: 'abc',
name: 'abc',
meta: {
icon: 'md-person-add',
title: '123',
notCache: true
},
component: () =>
import('@/view/userManagement/abc.vue')
},
{
path: 'abc2',
name: 'abc2',
meta: {
icon: 'ios-people',
title: '123',
notCache: true
},
component: () =>
import('@/view/userManagement/abc2.vue')
},
只嵌套一个子路由是可以正常渲染,多一个子路由就报内存溢出。有大神知道是怎么回事吗?
你解决了吗 ???