处理 vue history模式打包后页面为空白页的问题

在vue根目录下创建vue.config.js 文件

// product为工程名
module.exports = {
    publicPath: '/product/',
    outputDir: 'product'
}

修改router.js

// product为工程名
const router = new VueRouter({
  mode: 'history',
  base: '/product/',
  routes
})

修改Nginx配置

// product为工程名
location /product {
    index  index.html index.htm;
    try_files $uri $uri/ /product /;
}

转载至 http://www.gzui.net/archives/3234

猜你喜欢

转载自www.cnblogs.com/ronle/p/12935588.html