nginx 配置
server {
listen 90;
server_name localhost; # 服务器域名或 IP 地址
location / {
root D:/nginx-1.24.0/html/dist;
index index.html index.htm projectb.html;
}
}
vue 路由配置
const routes = [
{
path: '/',
name: 'Index',
component: Index,
},
{
path: '/scanCodeScreen',
name: 'scanCodeScreen',
component: scanCodeScreen,
},
{
path: '/IndexOld',
name: 'IndexOld',
component: IndexOld,
},
]
const router = new VueRouter({
mode: 'history', //去掉url中的#
base: '/',
routes,
})
export default router
window.open('http://localhost:90/scanCodeScreen', '_blank'); 报错404