{% extends base %} {% block body %} {% include examples/component/example_nav.html %} {% init tab_html1 = """
Tab名称: TAB1 TAB2 TAB3
""" %} {% init tab_html2 = """
Tab名称: TAB1 TAB2 TAB3
""" %} {% init html3 = """
TAB1 TAB2 TAB3
""" %} {% init html4 = """
Tab名称: TAB1 TAB2 TAB3
""" %} {% init html5 = """
TAB1 TAB2 TAB3
""" %} {% init html6 = """
块标题
TAB1 TAB2 TAB3
""" %} {% init html7 = """
全部 进行中 归档
""" %}

默认tab样式

{{tab_html2}}
{% raw tab_html2 %}

按钮tab

{{tab_html1}}
{% raw tab_html1 %}

按钮tab组

{% render tab_group_1 %} {% render tab_group_2 %}

按钮tab表格

{% render tab_table %}

按钮tab(深色模式)

{{html3}}
{% raw html3 %}

下划线tab

{{html4}}
{% raw html4 %}

外边框tab

{{html5}}
{% raw html5 %}
{{html6}}
{% raw html6 %}

分段选择器 (segment-style)

{{html7}}
{% raw html7 %}

选中项紫色实心胶囊 + 白字,未选中为透明底深灰字;配合 data-tab-key 由 x-tab.js 按 URL 参数自动高亮。

{% init tab_python_code = """from xnote.plugin import TabBox tab_box = TabBox(tab_key="tab_default_hide", tab_default="normal", css_class="btn-style") tab_box.add_item(title="常规Tab", value="normal") # 默认隐藏: 只有 tab_default_hide=secret 命中时才展示出来 tab_box.add_item(title="隐藏Tab", value="secret", default_hide=True)""" %}

默认隐藏的tab (default_hide)

{{tab_python_code}}
{% render tab_default_hide %}

「隐藏Tab」默认不展示,只有当 tab_default_hide 的值命中它的 value(这里是 secret)时才会显示并高亮;命中条件由 URL 参数决定。

跳转到隐藏Tab 回到常规Tab

{% include examples/page/example_script.html %} {% end %}