Vue-Router: $ router.go (-1) does not work in Safari

I have the following setting in App.vue:

<top-nav></top-nav>
<main>
    <router-view v-bind="{isOnline}"></router-view>
</main>

And in top-navjs, I have a method goBack:

methods: {
    goBack() {
        this.$router.go(-1);
    },
    ...
},

This works fine in Chrome and Internet Explorer, but Safari. When debugging and setting a breakpoint on this line, .go(-1)it gets to the breakpoint and everything looks fine (nothing is undefined). However, the navigation call is not made.

This does not work on mobile devices and on the desktop. I thought Safari supports history API?

+4
source share
1 answer

I found out that the icon that I used to return was wrapped in an anchor tag using an attribute href.

<a v-if="showBackButton" href="#" @click="goBack">
    <i class="icon icon-200-chevron-left-small"></i>
    <p>back</p>
</a>

Decision:

- , , href.

+2

Source: https://habr.com/ru/post/1689298/


All Articles