widgetti / reacton

A pure Python port of React for ipywidgets
https://reacton.solara.dev/
MIT License
289 stars 19 forks source link

How to use VuetifyTemplate method? #17

Closed camhpj closed 1 year ago

camhpj commented 1 year ago

I am trying to implement this very simple example with reacton.ipvuetify.VuetifyTemplate. The implementation if templates in reacton is a method instead of a class and I am unsure as to how you pass methods to the function (in this example the vue_btn_click).

import traitlets
import ipyvuetify

class TestWidget(ipyvuetify.VuetifyTemplate):
    template = traitlets.Unicode('''
        <template>
            <v-btn @click="btn_click">
                Button
            </v-btn>
        </template>
    ''').tag(sync=True)

    def vue_btn_click(self, data):
        print(1)

test = TestWidget()
test
camhpj commented 1 year ago

19