1. 程式人生 > >vue-router HTML5 History 模式

vue-router HTML5 History 模式

在webpack配置中,devserver配置如下:

  devServer: {
        clientLogLevel: 'warning',
        historyApiFallback: {
            rewrites: [
              { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
            ],
        }
        //其他的省略,暫未列出
 }

vue-router配置

const router = new VueRouter({
  mode: 'history'
, routes: [...] })