VUE3.0 路由

createWebHistory路由模式路径不带#号(生产环境下不能直接访问项目,需要nginx转发)

http://localhost:8080/

const router = createRouter({
  history: createWebHistory(),
  routes
});

// nginx 配置
location / {
root   /root/gshop;
index   index.html;
try_files   $uri   $uri/ /index.html;

createWebHashHistory路由模式路径带#号

http://localhost:8080/#/

const router = createRouter({
  history: createWebHashHistory(),
  routes
});
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容