- hash模式带#,#后面的地址变化不会引起页面的刷新
- history没有#,地址变化会引起页面刷新,更符合页面地址的规范(开发环境不刷新-webpack配置)
- 将路由模式修改成history模式-代码位置(**src/router/index.js)**
const createRouter = () => new Router({
mode: 'history', // require service support
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes // 默认引入静态路由
})
更改mode属性即可。