ipyvue
ipyvue copied to clipboard
feat: allow frontend code in events
Making the following possible:
import ipyvuetify as v
activator = v.Sheet(style_="width: 500px; height: 500px", elevation=8)
activator.on_event("contextmenu.prevent", "menu.on.click")
v.Sheet(children=[
v.Menu(
v_slots=[
{
"name": "activator",
"variable": "menu",
"children": [activator],
}
],
absolute=True,
children=[
v.Btn(children=["hi"])
],
),
])
One thing I noticed though, is that we need an extra right-click to show the menu on a different spot. So it might not be useful for the original envisioned use-case.
Any idea why this extra click is needed, is that an issue that needs solving?
It's just how Vuetify menu works. Click out-side first closes the menu, the next click opens the menu on the new position. This is fine for menu, but as a context menu this is a bit unexpected.
Right, that means for solara, we probably need a custom template anyway. I found this example https://codesandbox.io/s/vuetify-context-menu-opened-multiple-times-idstb?file=/src/main.js which seems impossible to do without a vue template. cc @iisakkirotko