Hi there,
really … simple question, very simple task …
I use that new Ionic 7 framework as a Vue-project. I seem to don’t know how to call the open() method on ion-menu. All I want to do is open the ion-menu programatically, described in the components documentation. Here’s a reduced version of my code …
Could please someone just show me, how I have to call open(), but without the error message in the console: “ASSERT: can not be animating”?
App.vue:
<template>
<ion-app>
<ion-menu menu-id="app-menu" content-id="main-content">
<ion-header>
<ion-toolbar>
<ion-title class="ion-text-center">
A Title ...
</ion-title>
</ion-toolbar>
</ion-header>
<ion-content class="ion-padding">
<ion-list>
<ion-item>
<ion-label>An item ...</ion-label>
</ion-item>
</ion-list>
</ion-content>
</ion-menu>
<ion-router-outlet id="main-content"></ion-router-outlet>
</ion-app>
</template>
<script lang="ts">
import { defineComponent, onMounted } from 'vue';
import {
...,
IonMenu,
menuController,
...,
} from '@ionic/vue';
export default defineComponent({
name: 'MainMenu',
components: {
...,
IonMenu,
...,
},
setup() {
onMounted(() => {
menuController.open('app-menu'); // Result as expected, but error message in console: ASSERT: can not be animating
})
return {
}
}
});
</script>