v-router的history模式

vue-router 默认 hash 模式 —— 使用 URL 的 hash 来模拟一个完整的 URL,于是当 URL 改变时,页面不会重新加载。
如果不想要很丑的 hash,我们可以用路由的 history 模式

const router = new VueRouter({
  mode: 'history',
  routes: [...]
})

当你使用 history 模式时,URL 就像正常的 url,例如 http://yoursite.com/user/id,也好看!
基于 Node.js 的 Express(coa等第三方库)
对于 Node.js/Express,请考虑使用 connect-history-api-fallback中间件

猜你喜欢

转载自blog.csdn.net/qq_43702430/article/details/86503056
今日推荐