pip install spiff python from spiff.globals import render, html, head, body def index(request): return html( head( title("Welcome to my website") ), body( h1("Hello, World!") ) ) if __name__ == "__main__": render(index) python from spiff.globals import render, html, head, body, script, button, on def index(request): def button_click(): print("Button clicked!") return html( head( title("Welcome to my website") ), body( h1("Hello, World!"), button("Click me", onclick=button_click), script( on("button_click", button_click), """ function button_click() { console.log("Button clicked!"); } """ ) ) ) if __name__ == "__main__": render(index)


上一篇:
下一篇:
切换中文