createWebHistory路由模式路径不带#号(生产环境下不能直接访问项目,需要nginx转发)
const router = createRouter({
history: createWebHistory(),
routes
});
// nginx 配置
location / {
root /root/gshop;
index index.html;
try_files $uri $uri/ /index.html;
createWebHashHistory路由模式路径带#号
const router = createRouter({
history: createWebHashHistory(),
routes
});