{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 徽章\n", "\n", "包裹Quasar的[QBadge](https://quasar.dev/vue-components/badge)组件的徽章元素。\n", "\n", "- `text`:文本字段的初始值\n", "- `color`:组件的颜色名称(可以是 Quasar、Tailwind 或 CSS 颜色,也可以是 `None`,默认为 `\"primary\"`)\n", "- `text_color`:文本颜色(可以是 Quasar、Tailwind 或 CSS 颜色,也可以是 `None`,默认为 `None`)\n", "- `outline`:使用 `'outline'` 设计(只有彩色文本和边框)(默认为 `False`)" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from nicegui import ui\n", "\n", "with ui.button('Click me!', on_click=lambda: badge.set_text(int(badge.text) + 1)):\n", " badge = ui.badge('0', color='red').props('floating')\n", "\n", "# ui.run()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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 }