mbj36/vue-burger-menu

Open side nav manually

clien007 opened this issue · 1 comments

Hi!

Just want to ask how to open the side nav manually or using javascript?

Thanks!

Hi,

You can use a reactive variable like here:
<Slide :isOpen=slideIsOpen @openMenu=openSlide @closeMenu=closeSlide></Slide>

data() {
    return {
        slideIsOpen : false //Closed at startup
    }
}
methods: {
    openSlide() {
        this.slideIsOpen = true
    } ,
    closeSlide() {
        this.slideIsOpen = false
    },
    toggleSlide() {
        this.slideIsOpen = !this.slideIsOpen
    }
}

and call the wanted method (this.openSlide(), this.closeSlide() or this.toggleSlide()) from your code :)