{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 轮播图\n", "\n", "这个元素代表了 Quasar 的 [QCarousel 组件](https://quasar.dev/vue-components/carousel#qcarousel-api)。它包含各个独立的轮播幻灯片。\n", "\n", "- `value`:`ui.carousel_slide` 或最初选择的幻灯片的名称(默认:`None`,表示第一张幻灯片)\n", "- `on_value_change`:当选定的幻灯片发生变化时要执行的回调函数\n", "- `animated`:是否对幻灯片过渡进行动画处理(默认:`False`)\n", "- `arrows`:是否显示用于手动滑动导航的箭头(默认:`False`)\n", "- `navigation`:是否显示用于手动滑动导航的导航点(默认:`False`)" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from nicegui import ui\n", "\n", "with ui.carousel(animated=True, arrows=True, navigation=True).props('height=180px'):\n", " with ui.carousel_slide().classes('p-0'):\n", " ui.image('https://picsum.photos/id/30/270/180').classes('w-[270px]')\n", " with ui.carousel_slide().classes('p-0'):\n", " ui.image('https://picsum.photos/id/31/270/180').classes('w-[270px]')\n", " with ui.carousel_slide().classes('p-0'):\n", " ui.image('https://picsum.photos/id/32/270/180').classes('w-[270px]')\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 }