You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the great project. I was following the notebook here for creating Vue components using the new syntax vue.VueTemplate.class_component_serialization. But no event can be pass from sub-component to main-component
This example works, and the parent can received the event my-event from child component
If I move the child component into a VueTemplate class, The GUI is rendered correctly, however the event my-event is blocked. No event can be pass from Child to Parent
Hi, I'd like to know if someone investigated this issue.
As I define pythonic callback, I need to use the second above example.
To get around this problem, I need to define a parent attribute for child class.
import ipyvue as vue
import ipywidgets
import traitlets
class Child(vue.VueTemplate):
childProp = traitlets.Unicode('childProp').tag(sync=True)
template = traitlets.Unicode('''
<template>
<div>
Prop from parent:
<h3> {{ childProp }} </h3>
<button @click="at_click('new value')">change</button>
</div>
</template>
''').tag(sync=True)
def __init__(self, parent=None, *args, **kwargs):
vue.VueTemplate.__init__(self, *args, **kwargs)
self.parent = parent
def vue_at_click(self, value):
"""Callback called when clicking on the button"""
if parent is not None:
self.parent.test()
class Parent2(vue.VueTemplate):
someProp = traitlets.Unicode('hello').tag(sync=True)
child = traitlets.Any().tag(
sync=True, **ipywidgets.widget_serialization
)
template = traitlets.Unicode('''
<template>
<div>
<jupyter-widget :widget="child" />
<h3>Parent: {{ someProp }} </h3>
</div>
</template>
''').tag(sync=True)
def __init__(self, parent=None, *args, **kwargs):
vue.VueTemplate.__init__(self, *args, **kwargs)
self.child = Child(parent=self, childProp="hack")
def test(self, data):
print('can not receive from child')
self.someProp = 'not changed'
parent = Parent2()
parent
Thanks for the great project. I was following the notebook here for creating Vue components using the new syntax
vue.VueTemplate.class_component_serialization
. But no event can be pass fromsub-component
tomain-component
This example works, and the parent can received the event
my-event
from child componentIf I move the child component into a
VueTemplate
class, The GUI is rendered correctly, however the eventmy-event
is blocked. No event can be pass fromChild
toParent
The parent did not receive the event.
Is this due to the different implementation on event handling between the
VueModel
andVueTemplate
?The text was updated successfully, but these errors were encountered: