spz-tabs
Tabs make it easy to switch between different views.
布局
Layouts
跳转到“Layouts”Usage
跳转到“Usage”- The element must have a child element with a
role="tabs"attribute. - The child elements of the element with a
role="tabs"must use arole="tab"to mark a child tab. - A child tab must have a
data-panelattribute to map content that has adata-idattribute. Thedata-panelanddata-idvalues are the same. - A content block must have a
role="tabpanel"as a mark.
When we click a child tab, it will be added an active attribute and remove the others. With this, all content blocks also toggle an active accordingly.
<spz-tabs layout="container">
<ul role="tabs">
<li role="tab" data-panel="tab-1" active>Tab1</li>
<li role="tab" data-panel="tab-2">Tab2</li>
</ul>
<!-- content block -->
<div role="tabpanel" data-id="tab-1" active>
Tab 1 content
</div>
<div role="tabpanel" data-id="tab-2">
Tab 2 content
</div>
</spz-tabs>
Attributes
跳转到“Attributes”hover-interact
跳转到“hover-interact”If this attribute is present, the element toggles tab with mouse hover.
Actions
跳转到“Actions”tabChange
跳转到“tabChange”tabChange(index=<Number>)
To change a child tab to active status. It has the following parameters:
index: an integer number with begin zero. Changes the second child tab toactivestatus when theindexvalue is 1.
<button type="button" @tap="tabs.tabChange(index=1);">
Activate the second tab
</button>