Can vue-router use the navigation guard to write a returned function globally?

vue-router returns to the previous page:

this.$router.go(-1)

there are many pages in my project, and the button on each page wants to return to the previous page. Can this function use the navigation guard to write one globally?

Mar.21,2021

vue-router has a global guard: router.beforeRouteLeave. You can use this unified setting to set the action when a route leaves
reference: ide/advanced/navigation-guards.html" rel=" nofollow noreferrer "> https://router.vuejs.org/zh/g.

Menu