1、$route 路由对象
$route对象表示当前的路由信息,包含当前的路径,参数,query对象等。
1. $route.path 当前路由的路径
2. $route.params 动态参数
3. $route.query 查询字符串
2、$router 路由器对象
$router是router构造方法的实例。
-
push
1.字符串this.$router.push(’/home’)
向 history 栈添加一个新的记录 -
back 返回上一路由
$router.back() -
replace
push方法会向 history 栈添加一个新的记录,而replace方法是替换当前的页面,不会向 history 栈添加一个新的记录