使用 ipyvuetify,我Textfield
必须Textarea
在ExpansionPanel
. 它们的交互是链接的,因为它们代表 DB 行中的两个字段。
是否可以创建一个自定义小部件,它包含不同的嵌套 ipyvuetify 小部件,并允许作为单个对象与整个组进行交互,并且在调用时也像小部件一样呈现?
像这样的东西:
import ipyvuetify as vue
Class customWidget():
def __init__(self, titleText, bodyText):
title = vue.TextField(class_='mb-n2', label='Label')
title.value = titleText
title.on_event('click.stop', None)
openIn= vue.Btn(text=True, max_width='10px', children=[vue.Icon(children=['open_in_new'])])
openIn.on_event('click.stop', None)
note = vue.Textarea(class_='ma-0 pa-0 text-xs-caption', name='markerA', solo=True, elevation=0, outlined=True)
note.value = bodyText
panel = vue.ExpansionPanel(class_='ma-0 pa-0 text-xs-caption', children=[
vue.ExpansionPanelHeader(class_='ma-0 pa-0 pl-5 pr-5', children=[title, openIn]),
vue.ExpansionPanelContent(class_='ma-0 pa-0 text-xs-caption', children=[note]),
])
self.expansionPanel = vue.ExpansionPanels(v_model=[0], multiple=True, focusable=False, children=[panel])