//main.js中引用了 定义路由的js文件
//异步组件
const FrameCore = () => import('../views/form/frame/FrameCore.vue');
{
path: '/framecore:form?',
component:FrameCore,
name: 'framecore',
children: [
//更多操作(提成反结账),路由跳转打开新界面或弹框
{path: '/noCheckOut_RY:form?', component: NoCheckOut_RY, name: 'noCheckOut_RY'},
{path: '/noCheckOut_DN:form?', component: NoCheckOut_DN, name: 'noCheckOut_DN'},
],
},
{
path: '/treeformview:form?',
component:resolve => require(['../views/form/frame/TreeFormView.vue'], resolve) ,
name: 'treeformview'
},
//webpack的配置
entry: {
main: ["babel-polyfill", './src/main.js'],
},
output: {
libraryTarget: 'umd',
path: path.resolve(__dirname, './dist'),
//publicPath: '/cqpt/dist/', //打包发布
publicPath: '/dist/', //打包开发(不影响热加载)
filename: 'js/[name].js',
chunkFilename: "js/[name].[chunkhash:8].js"
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery'
}),
new ExtractTextPlugin("css/styles.css"),
new HtmlWebpackPlugin({
template: "index.html",
favicon: resolveApp('favicon.ico'),
inject: true,
hash: true
}),
new webpack.optimize.CommonsChunkPlugin("common.js"),
],
异步组件的引用方式应该是这样的
const FrameList= () => import(/ webpackChunkName: "framelist" /'../views/framelist/Framelist.vue').then(m => m.default);