go(-1): 原页面表单中的内容会丢失
this.$router.go(-1) 后退+刷新
this.$router.go(0) 刷新
this.$router.go(1) 前进
back(): 原页表表单中的内容会保留
this.$router.back() 后退
this.$router.back(0) 刷新
this.$router.back(1) 前进
this.$router.back()和this.$router.go()区别
于 2023-05-22 16:37:41 首次发布
在Vue应用中,使用`this.$router.go`和`this.$router.back`对页面进行导航时,会影响表单内容。`go(-1)`后退会导致表单内容丢失,而`back()`则能保留内容。通过调整参数,可以实现刷新页面或前进到其他页面的操作。
摘要由CSDN通过智能技术生成