zl程序教程

您现在的位置是:首页 >  Javascript

当前栏目

VUE路由设置history模式刷新404处理

2023-02-25 18:19:44 时间

vue路由配成history模式,需要设置base,如果不设置base刷新页面会报404错误 const router = new Router({     mode: 'history',     base: '/weegClient/',     routes }) 打包时vue.config.js配置 module.exports = {     // publicPath: '/', // 根路径 /pages/dist/     publicPath: '/weClient', // 根路径 /pages/dist/ nginx配置 location /weegClient {   #root   html;    alias   html\weegClient;   try_files $uri $uri/ /weClient/index.html;   index  index.html index.htm; }