HTML5 History 模式
history 模式: 利用 history.pushState API 来完成 URL 跳转而无须重新加载页面( 去除 # )
const router = new VueRouter({
mode: 'history',
routes: [...]
})
mode
type: string ( 默认: "hash" (浏览器环境) | "abstract" (Node.js 环境)
options: "hash" | "history" | "abstract"
配置路由模式
hash: 使用 URL hash 值来作路由 ( 去除 # 号 )
history: ( 去除 # 号 )
abstract: 支持所有 JavaScript 运行环境,如 Node.js 服务器端。如果发现没有浏览器的 API,路由会自动强制进入这个模式