VUE3.0 createWebHistory 和 createWebHashHistory

createWebHistory

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

http://localhost:8080/

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

createWebHashHistory

路由模式路径带#

http://localhost:8080/#/

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

推荐阅读更多精彩内容

  • createWebHistory路由模式路径不带#号(生产环境下不能直接访问项目,需要nginx转发) http:...
    MaJiT阅读 35,771评论 2 2
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,469评论 19 139
  • 转载自:https://segmentfault.com/a/1190000019391139[https://s...
    坚持努力_573f阅读 6,882评论 0 0
  • Vue Router 是Vue.js[http://cn.vuejs.org/]官方的路由管理器。它和 Vue.j...
    SY阅读 3,890评论 0 0
  • vue3.0 +vite部署完成上线刷新404 问题原因: 路由模式为history模式 刷新会404处理方案 使...
    塔塔七阅读 9,013评论 0 1