Within my HTML code, I have utilized a RouterLink
within an li
tag to create a basic dropdown menu. Currently, when options are displayed in the dropdown menu, I am only able to click on the text itself to navigate to the next page. However, I would like to be able to click anywhere within the entire "bar", represented by the li
tag, to accomplish the same action.
<ul>
<li v-for="product in products">
<RouterLink :to="/product"> {{product}} </RouterLink>
</li>
</ul>
This implementation results in a dropdown structure like this:
| product name |
| product 2 name |
Currently, clicking solely on the text achieves the desired effect, but I aim to enable clicking within the box as well. Is there a solution for this issue? Additionally, how can I close the dropdown menu when clicking outside of it?