1.vue前端多级域名部署
1.vite.config.js
base: VITE_APP_ENV === 'production' ? '/xx1/xx2/' : '/xx1/xx2/',
2.src/router/index.js
history: createWebHistory('/xx1/xx2'),
3.src/layout/components/Navbar.vue
function logout() {
ElMessageBox.confirm("确定注销并退出系统吗?", "提示", {
...
location.href = "/xx1/xx2/index";
}
4.nginx.conf
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ /xx1/xx2/index.html;
index index.html index.htm;
}