R
R
r_g_b_a2020-08-08 13:54:14
JavaScript
r_g_b_a, 2020-08-08 13:54:14

How to move menu to another html element in vue?

Hello.
I have multiple blocks on a page. Each of them contains a button and a menu. All menus will be completely identical, so I thought it was a good idea to create just one and show it inside the desired block.
I have two ideas on this:
1) Move the html code of the menu (for example, as the append method in jquery does)
2) Use absolute positioning, get the parent's coordinates and update them on the resize event
Tell me how to do it correctly on vue ? Demo with buttons and one menu

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-08-08
@r_g_b_a

You don't need to move anything. Make a component, and let there be only one open menu .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question