I. Code address of this article:

Gitee.com/gyy_xiaobai…

Second, ask questions:

For example, there are two pages, pageA, pageB, then how to enter the browser address, you can directly access these two pages, and pass some parameters:

http://localhost:52143/#/pageA?name=100

Three, solve the problem:

1. We can load this code in the build function of our App and see the effect:
Var defaultRoute = window.defaultroutename; Uri route = Uri.parse(defaultRoute); debugPrint(defaultRoute); // /loginPage? Name =100 // get route "?" DebugPrint (route.path); // /loginPage // get route "?" At the back of the string debugPrint (route. QueryParameters. ToString ()); // {name: 100}Copy the code

So, we can go through

window.defaultRouteName
Copy the code

Get path and queryParameters on the browse route, so you can do a few things;

2. At this point, queryParameters on the browser can be obtained
3. How to jump to the corresponding routing page?

“/ “, “/noFoundPage”, “/loginPage”

Type in your browser:

http://localhost:8008/#/loginPage

The actual result is as follows. The page is displayed

Go ahead and type in your browser

http://localhost:8008/#/loginPage?name=100

The actual effect is as follows. The loginPage page is not redirected as expected.

4. Problem solving: the actual problem lies in the Routers. OnGenerateRoute method.

Routers.onGenerateRoute

Modified as follows:

— At this point, the problem is resolved, can jump to any interface, with parameters —