我想在中获取上一页链接或URL vue-router
。像这样 怎么做?
const link = this.$router.getPrevLink(); // function is not exist?
this.$router.push(link);
近概念是this.$router.go(-1)
。
this.$router.go(-1);
我想在中获取上一页链接或URL vue-router
。像这样 怎么做?
const link = this.$router.getPrevLink(); // function is not exist?
this.$router.push(link);
近概念是this.$router.go(-1)
。
this.$router.go(-1);
所有vue-router的导航卫士都将前一条路线作为
from
参数接收..As an example you could use
beforeRouteEnter
, an in-component navigation guard, to get the previous route and store it in your data ..Then you can use
this.prevRoute.path
to get the previous URL.