当前位置:网站首页>Router object, route object, declarative navigation, programmed navigation
Router object, route object, declarative navigation, programmed navigation
2022-04-23 17:15:00 【MiMenge】
Router and Route
When we create an instance VueRouter when
let router = new VueRouter();
There will be a whole picture router Router object , This router object can pass through... On other routing components An instance of the routing component .$router Access to
When jumping to a new route , It will create a new one route Instance object , Each routing instance is unique , Save the status information of the current route .
Be careful : There is only one in the application Router object , Accessed in each routing component Router object It's all one Router example , Between each other same , But every one of them Between routes Of route yes Different .
Attribute method
$router
console.log(this. $ router);
- attribute
| attribute | describe |
|---|---|
| options | Saved the original configuration object that created the route |
| currentRoute | Address information and information of the current route this.$route Agreement |
- Method
+ Method
- addRoute(parentName, route) : Add a row of route records to the route
- afterEach(to, from, failure) : Global route navigation post guard , Execute every time after switching routes
- beforeEach(to, from, failure): Global route navigation front guard , Every time before switching routes
- push({
path: Routing path ,
name: Routing name ,
query:{
} Delivered query Parameters ,
params:{
} Delivered params Parameters ,
}): Jump to a route , Jump to... In the way of programmed navigation , Pass in an object
Consistent with the declarative route navigation configuration properties , Because it is pushing a record into the record stack
So jump back Will be back to back Previous routing records ( Not replaced )
- replace({
}) : Jump to a route , Navigate programmatically , Parameters and push Agreement
Because the current record of the routing record stack is replaced by , So you can't go back to the previous record after jumping
You can only go back to the previous record of the previous record ( Replaced )
- resolve({
}): Jump to a new page , Parameters and push Agreement
- back(): Go back to the previous route
- forward(): Forward a route record in the historical route
- getRoutes(): Get a complete list of routes
- go(num): Forward or backward in the historical routing record , Before or after depends on the plus or minus of the parameter
- hasRoute(routeName): Check whether there is a specified name The routing
- removeRoute(routeName): Remove the corresponding route record in the stack
- onError(function(err)···): Capture errors that occur during navigation
$route
console.log(this.$route);
- fullPath : Jump to the full path of the route
- hash: Currently routed hash value , Nothing is empty
- meta: Routing meta information
- name: The name of the route definition
- matched : Array , Contains configuration parameter objects corresponding to all fragments contained in the current matching path .
- path: The absolute path corresponding to the current route ( obtain )
- params: Currently routed params Parameters ( obtain )
- query: Currently routed query Parameters ( obtain )
Declarative navigation and functional navigation
Navigation :
A route is executed once , It's just a navigation . Navigation can be divided into declarative navigation and programmatic navigation .
Declarative navigation :
A routing component ( Such as router-link) Route jump can be realized by clicking , This process is called “ Declarative navigation ( static state )”.
Programming navigation :
Switching execution is not achieved through declarative navigation , Through the way of program code , Namely “ Programming navigation ( dynamic )”.
Implementation of programming navigation :
Use directly through router objects js Code operation
1. Declarative navigation is rendered directly to the page , such as a link
2. Programmed navigation is used in js After processing the logic, you need to jump to the page , For example, click on button Button jump
版权声明
本文为[MiMenge]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230553027382.html
边栏推荐
- Generate random numbers with high quality and Gaussian distribution
- Preliminary understanding of promse
- BUG_ me
- PHP efficiently reads large files and processes data
- Milvus 2.0 质量保障系统详解
- Using quartz under. Net core -- job attributes and exceptions of [4] jobs and triggers
- Tencent resolves the address according to the IP address
- Your brain expands and shrinks over time — these charts show how
- 线性代数感悟之1
- Devexpress GridView add select all columns
猜你喜欢
![Using quartz under. Net core -- job attributes and exceptions of [4] jobs and triggers](/img/ec/43dddd18f0ce215f0f1a781e31f6a8.png)
Using quartz under. Net core -- job attributes and exceptions of [4] jobs and triggers

Lock lock
![[difference between Oracle and MySQL]](/img/90/6d030a35692fa27f1a7c63985af06f.png)
[difference between Oracle and MySQL]

【生活中的逻辑谬误】稻草人谬误和无力反驳不算证明

Solution architect's small bag - 5 types of architecture diagrams

Detailed explanation of Milvus 2.0 quality assurance system

Further study of data visualization

【WPF绑定3】 ListView基础绑定和数据模板绑定

Lock锁

Clickhouse table engine
随机推荐
1-3 nodejs installation list configuration and project environment
Your brain expands and shrinks over time — these charts show how
Variable length parameter__ VA_ ARGS__ Macro definitions for and logging
Aiot industrial technology panoramic structure - Digital Architecture Design (8)
JSON deserialize anonymous array / object
PHP efficiently reads large files and processes data
Customize my_ Strcpy and library strcpy [analog implementation of string related functions]
Come out after a thousand calls
JS failed to change all variables and changed to the return method. Finally, the problem was solved
1-2 JSX syntax rules
oracle 中快速获取表的列名列表
1-5 nodejs commonjs specification
Interface document yaml
ASP. Net core reads the configuration file in the class library project
New keyword learning and summary
Detailed explanation of the penetration of network security in the shooting range
Solution architect's small bag - 5 types of architecture diagrams
matlab如何绘制已知公式的曲线图,Excel怎么绘制函数曲线图像?
Read a blog, re understand closures and tidy up
Promise (I)