{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## 开关\n", "\n", "这个元素是基于Quasar的[QToggle](https://quasar.dev/vue-components/toggle)组件。\n", "\n", "- `text`:显示在开关旁边的标签\n", "- `value`:初始是否应勾选(默认为 `False`)\n", "- `on_change`:值改变时执行的回调函数" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from nicegui import ui\n", "\n", "switch = ui.switch('switch me')\n", "ui.label('Switch!').bind_visibility_from(switch, 'value')\n", "\n", "# ui.run()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\n" ] } ], "metadata": { "kernelspec": { "display_name": "py311", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.7" } }, "nbformat": 4, "nbformat_minor": 2 }