How to close sidemenu on clicking a list item inside side menu
-
Im a beginner in quasar, how to close sidemenu on clicking an list item?
<q-item v-for=“chapt in chapterlist” @click=“chaptSelected=chapt.value”>
<q-item-side icon=“school” />
<q-item-main v-bind:label=“chapt.label” sublabel=“quasar-framework.org” />
</q-item> -
Also, supposing you are using a layout and have a reference to it, do this
// set a reference of 'layout'. could also be 'my-layout', 'bestlayout', etc <q-layout ref="layout"> <div slot="left"> // use reference you set earlier <span @click="$refs.layout.hideLeft()">any item will do</span> </div> </q-layout>
-
how to do this if i want to call a function
@click=“myFunction()”
where to put this $refs.layout.hideLeft() ?
-
... <q-layout ref="layout"> <!-- Content goes here --> </q-layout> ... methods: { myFunction () { this.$refs.layout.hideLeft() } }
This assumes you are doing this in one
.vue
file. Reply if you need to access this method from a descendant component of theq-layout
-
@benoitranque thank you, i will try this one