# 路由 路由是一种在应用程序中切换视图的流行方式。 此页面提供了有关如何执行此操作的一些指导。 ## Vue 在 Vue 中推荐的路由方法是 [Hash 模式](https://next.router.vuejs.org/guide/essentials/history-mode.html#hash-mode): ```js import { createRouter, createWebHashHistory } from "vue-router"; const router = createRouter({ history: createWebHashHistory(), routes: [ //... ], }); ``` ## Angular 在 Angular 中推荐的路由方法是 [HashLocationStrategy](https://codecraft.tv/courses/angular/routing/routing-strategies/#_hashlocationstrategy): ```ts RouterModule.forRoot(routes, { useHash: true }); ``` ## React 在 React 中推荐的路由方法是 [HashRouter](https://reactrouter.com/en/main/router-components/hash-router): ```jsx import { HashRouter } from "react-router-dom"; ReactDOM.render( {/* The rest of your app goes here */} } exact /> } /> } /> {/* more... */} , root ); ```