1👍
✅
You can use template refs
to do this:
<div class="menu" ref="menu">
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>
export default {
name: 'Button',
data() {
return {
activeToggle: false
}
},
methods: {
menuToggle() {
if (this.activeToggle == true) {
// Access the menu using template $refs
const menu = this.$refs.menu
}
},
},
}
Source:stackexchange.com