vue-cli创建的项目,配置多页面的实现方法

2020-06-14 06:00:39易采站长站整理

new HtmlWebpackPlugin({
filename: 'rule.html',
template: 'rule.html',
inject: true,
chunks:['rule'] }),

修改build/webpack.prod.conf.js

在plugins增加


new HtmlWebpackPlugin({
filename: config.build.rule,
template: 'rule.html',
inject: true,
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
// more options:
// https://github.com/kangax/html-minifier#options-quick-reference
},
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunksSortMode: 'dependency',
chunks: ['manifest','vendor','rule'] }),

以上全部

当后台地址跳转到你的新建的页面后,由于现在配置的默认路由是公用的,可自己配置多个路由文件,分别引用。

可在Rule.vue中路由跳转到指定路由,以实现页面控制


mounted: function() {

this.$router.replace({
path:'/rule'
});
},

以上这篇vue-cli创建的项目,配置多页面的实现方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持软件开发网。