I want to be able to hide/show the component in question, but from another component
Something like
-dropdown.Vue
<q-expansion-item
expand-separator
icon="perm_identity"
label="Account settings"
caption="John Doe"
>
<q-card>
<q-card-section>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quidem, eius reprehenderit eos corrupti
commodi magni quaerat ex numquam, dolorum officiis modi facere maiores architecto suscipit iste
eveniet doloribus ullam aliquid.
</q-card-section>
</q-card>
</q-expansion-item>
closeDrop.Vue
<script>
methods: {
click() {
expansion-item.hide
}
}
</script>
Take in account that there is already @hide and @show methods in the component, but I weren't totally able to manage it from vuex!
Just set the v-model
as explained in https://quasar.dev/vue-components/expansion-item#Controlling-expansion-state:
<q-expansion-item
v-model="expanded"
icon="perm_identity"
label="Account settings"
caption="John Doe"
>
And in your script add an expanded
variable to your data:
export default {
data: () => ({
expanded: false
})
}
You can now toggle the expanded state by simply modifying the value of expanded
:
this.expanded = true