# Tabs 分頁
內容區域切換元件。線形 / 卡片兩種外觀,支援停用、可關閉、可新增與底部分頁。
分頁
<template>
<div class="demo-col" style="max-width: 640px; gap: 20px">
<LhTabs v-model="active">
<LhTabPane name="song" label="宋代">
<p class="demo-note">范寬《溪山行旅圖》、郭熙《早春圖》。</p>
</LhTabPane>
<LhTabPane name="yuan" label="元代">
<p class="demo-note">黃公望《富春山居圖》。</p>
</LhTabPane>
<LhTabPane name="ming" label="明代" disabled>
<p class="demo-note">停用分頁。</p>
</LhTabPane>
</LhTabs>
<p class="demo-note">v-model={{ active }}</p>
<LhTabs v-model="active2" type="card" tab-position="bottom" closable addable>
<LhTabPane v-for="t in panes" :key="t.name" :name="t.name" :label="t.label">
<p class="demo-note">{{ t.label }} 內容</p>
</LhTabPane>
</LhTabs>
<p class="demo-note">card + 底部分頁 + closable + addable</p>
</div>
</template>
<script>
export default {
data: () => ({
active: 'song',
active2: 'a',
panes: [
{ name: 'a', label: '卷軸 A' },
{ name: 'b', label: '卷軸 B' },
{ name: 'c', label: '卷軸 C' },
],
}),
}
</script>
# Tabs Props
| 屬性 | 說明 | 類型 | 預設值 |
|---|---|---|---|
| v-model | 當前啟用分頁的 name(受控 modelValue prop) | string | — |
| type | 外觀 | 'line' \| 'card' | 'line' |
| closable | 分頁是否可關閉 | boolean | false |
| addable | 是否顯示新增按鈕 | boolean | false |
| tabPosition | 分頁位置 | 'top' \| 'bottom' | 'top' |
| sx | sx 快速佈局屬性 | — | — |
# TabPane Props
| 屬性 | 說明 | 類型 | 預設值 |
|---|---|---|---|
| name | 分頁唯一標識(作為穩定鍵,不建議動態修改) | string | — |
| label | 分頁標題 | string | — |
| disabled | 是否停用 | boolean | false |
# Slots
| 插槽 | 說明 |
|---|---|
| TabPane default | 分頁內容 |
Copyright © 2024-2026 风默文学 | 宁ICP备2024006574号 |
苏公网安备32040002010537