1. The hash pattern
Vue-router defaults to hash mode — the hash of a URL is used to simulate a full URL so that the page does not reload when the URL changes.
2. The history mode
If you don’t want ugly hashes, you can use the history mode of the route, which takes full advantage of the history.pushState API to do URL jumps without reloading the page. The history mode requires background configuration support
3. Principle of routing Users can manually enter or interact with the page to change the URL, and then send a request to the server to obtain resources (of course, resources may also exist locally) synchronously or asynchronously. After the request succeeds, the UI is redrawn.
Zhuanlan.zhihu.com/p/20381597?…
4. Route transmission parameters
A: <Route path=' /sort/:id 'component={sort}></Route> 2.Link <Link to={' /sort/' + ' 2'} activeClassName='active'>XXXX</Link> JS method this.props.history.push('/sort/'+'2') 3. Sort through this page. Props. Match the params. Id can receive the passed parameter (id) method 2: through the query premise: must jumped from other pages, parameters can be passed Note: Routing tables do not need to be configured. <Route path='/sort' Component ={sort}></Route> 1.Link HTML <Link to={{path: '/sort', query: {name: Push ({path: '/sort',query: {name: 'sunny'}}) 2. Sort page this. Props. Location. Query. Name three ways: <Link to={{path: '/sort', state: {name :' sunny'}}}> JS mode: this.props. History. push({pathName :'/sort',state:{name: 'sunny'}}) 2. Sort page this. Props. The location. The state. The name ` ` `Copy the code