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

2023-01-15 09:44:56 浏览数 (1)

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   htmlweegClient;   try_files $uri $uri/ /weClient/index.html;   index  index.html index.htm; }

0 人点赞