Vue 路由器工作的两种模式 hash history
一、概念
1、对与url来说 # 后面的内容就是hash值
2、hash值不包含在http请求中,即:hsah值不会带给服务器
3、hash模式
a、地址不美观带有#
b、地址可能会被校验不合法
c、兼容性好
4、histroy模式
a、地址干净、整洁
b、兼容性比hash模式差
c、部署需要解决服务器404问题,页面刷新时
二、使用
1、设置
src/store/index.js
const router = new VueRouter({ // mode: 'hash', mode:'history', routes:[ ] })
2、注意
默认是hash方式