Ion-menu not working after back-button press

I’m New to ionic and try my first project.
When I click on a link and then ion-back-button the ion-menu 's does not work.
When I click on a link again it works.
The BaseLayout.vue file:

<template>
    <ion-page>
    <ion-router-outlet id="main"> </ion-router-outlet>
        <menu-left></menu-left>
        <menu-right></menu-right>
        <ion-header>
            <ion-toolbar>
                <ion-buttons slot="start">
                    <ion-menu-button></ion-menu-button>
                    <ion-back-button color="danger"></ion-back-button>
                </ion-buttons>
                <ion-title>Test title
                   <div class="test1"> <router-link to="/r2/"> TEST 1</router-link></div>
                </ion-title>
                <ion-buttons slot="end">
                    <ion-menu-button></ion-menu-button>
                </ion-buttons>
            </ion-toolbar>
        </ion-header>
        <ion-content>
            <slot />
        </ion-content>
    </ion-page>
</template>

in the router/index.js file

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})
export default router