this.$router.go和this.$router.push以及this.$router.replace的区别

vue路由跳转
	1、this.$router.go(val)    这里val一般是 number类型  通常是前进或者后退几个层级,
	在history中增加一个历史记录, 如果为0,则代表刷新当前页;
	2、this.$router.push(param)  这里的param一般是路径名,
	而且在history中增加一个历史记录,可返回,比如this.$router.push(“/home”) 
	3、this.$router.replace(param)  这里的param一般是路径名,代表替换当前路由,
	无法通过history返回到上一个页面。

猜你喜欢

转载自blog.csdn.net/Taurus_0811/article/details/91845660