From e2a1a6ab0485f8a35647b72afb2f7498ee79b126 Mon Sep 17 00:00:00 2001 From: qinshenxue Date: Thu, 9 Nov 2017 16:28:57 +0800 Subject: [PATCH 1/2] create branch mpa1 --- README.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 26f0428..7eb7fce 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,6 @@ # vue2-vue-router2-webpack3 ## Blog -《从零搭建vue2+vue-router2+webpack3工程》 +《搭建 vue2 vue-router2 webpack3 多入口工程》 场景一 -[http://www.qinshenxue.com/article/20161118151423.html](http://www.qinshenxue.com/article/20161118151423.html) - -## Demo - -[https://qinshenxue.github.io/vue2-vue-router2-webpack2/](https://qinshenxue.github.io/vue2-vue-router2-webpack2/) +[http://www.qinshenxue.com/article/20171102091836.html](http://www.qinshenxue.com/article/20171102091836.html) From 048d008747160a80710b89e8eb5b30897097796c Mon Sep 17 00:00:00 2001 From: qinshenxue Date: 2017年11月13日 10:13:25 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=B7=AF=E7=94=B1=20history=20=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=EF=BC=8C=E5=A4=9A=E6=A8=A1=E5=9D=97=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/dev.js | 6 ++++++ build/utils.js | 2 +- src/admin/router.js | 4 +++- src/web/router.js | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/build/dev.js b/build/dev.js index f0c42af..282bc03 100644 --- a/build/dev.js +++ b/build/dev.js @@ -6,6 +6,12 @@ var compiler = webpack(devConfig); var server = new webpackDevServer(compiler, { hot: true, quiet: true, + historyApiFallback: { + rewrites: [ + { from: /^\/web/, to: '/web/index.html' }, + { from: /^\/admin/, to: '/admin/index.html' } + ] + }, publicPath: config.dev.outputPublicPath, stats: { colors: true } }); diff --git a/build/utils.js b/build/utils.js index c599086..d40c05e 100644 --- a/build/utils.js +++ b/build/utils.js @@ -70,7 +70,7 @@ exports.genHtmlPlugins = function () { Object.keys(baseWebpackConfig.entry).forEach(function (name) { plugins.push( new HtmlWebpackPlugin({ - filename: isProd ? path.resolve(__dirname, `../dist/${name}/index.html`) : name + '.html', + filename: isProd ? path.resolve(__dirname, `../dist/${name}/index.html`) : `${name}/index.html`, template: 'index.tpl.html', chunks: isProd ? ['manifest','vendor',`${name}-vendor`, name] : [name], inject: true diff --git a/src/admin/router.js b/src/admin/router.js index 90b8f00..4285a47 100644 --- a/src/admin/router.js +++ b/src/admin/router.js @@ -1,11 +1,13 @@ import index from './views/index.vue' import table from './views/table.vue' export default { + base: process.env.NODE_ENV === "production" ? '/' : '/admin/', + mode: 'history', linkActiveClass: 'active', routes: [{ path: '/', component: index - },{ + }, { path: '/table', component: table }] diff --git a/src/web/router.js b/src/web/router.js index 79bc7ac..3965772 100644 --- a/src/web/router.js +++ b/src/web/router.js @@ -6,6 +6,8 @@ import sass from './views/sass.vue' import image from './views/image.vue' import iconfont from './views/iconfont.vue' export default { + base: process.env.NODE_ENV === "production" ? '/' : '/web/', + mode: 'history', linkActiveClass: 'active', routes: [{ path: '/',

AltStyle によって変換されたページ (->オリジナル) /