获取来源路由

export default {
  data() {
    return {
      targetPath: ""
    }
  },
  beforeRouteEnter (to, from, next) {
  	// 此处无法通过 this 访问当前实例
    next(vm=> {
      // 此处可通过 `vm` 访问当前组件实例
      vm.targetPath = from.path;
    })
  }
}

Logo

前往低代码交流专区

更多推荐