VUE- routing (f) routing meta information

Do check permissions

Students and community pages show, did not let see login information

You can navigate guard these two routes, in order to avoid coupling codes, use the global guard

So use to route meta information (meaning information is added to a routing)

Plus also give commnity

Information can be found in the path to the Route.beforeEach

There is no set of meta, meta data is empty, there are settings login: true of information

When entering the community, because the page is redirected to academic discussion, there is no login: true of information

The information is matched to information for the entire route

If the path is / a / b / c / d then he comprising: / a / a / b / a / b / c / a / b / c / d

It can take to.mached judgment, it is the array to see if there are so many paths included in the meta information, login meta if there is, it is proved that the path needs to guard

Set login to true in a cookie

You can jump to the page of the student community

Users can not change their own cookie, so we added this feature in the code

Configuring login path:

login page:

Click on the above functions are required to log on to the page, suggesting need to sign in, log on to it, determined to jump to the login page, do not move canceled

In the login page you can set up a button

 

Guess you like

Origin www.cnblogs.com/tianya-guoke/p/11519905.html