如何处理 vue.js 中的回退问题?

问题描述 投票:0回答:0

我正在通过链接 vue2 和 spring boot 来处理这个项目。

搭建vue运行spring boot时出现如下错误

enter image description here

@Controller
public class WebErrorController implements ErrorController{

    @GetMapping({"/","/error"})
    public String redirctRoot() {
        return "index.html";
    }
    
}

所以我在 spring boot 中使用 ErrorController 解决了它。

但是我被要求在vue2中处理这个错误。

如何处理 vue.js 中的回退问题?

我试过 navigation guard 但它没有通过这个代码

router.beforeEach((to, from, next) => {
  console.log('before');
  console.log(to);
  console.log(from);
  next()
})

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')

spring-boot vue.js fallback
© www.soinside.com 2019 - 2024. All rights reserved.