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