索引標籤

索引標籤組件由兩個簡碼組成

  • {{< tabs >}}
  • {{< tab name="索引標籤的名稱" >}}

{{< tabs >}} 簡碼是一個父組件,用於包裝多個 tabs。每個 {{< tab >}} 都使用 name 屬性指定一個名稱。

您可以選擇性地為 tabs 包裝器指定一個 group 屬性,以指示索引標籤區塊應屬於某個索引標籤群組。請參閱 群組

範例


console.log("hello world")
fmt.Println("hello world")

標記

{{< tabs >}}
{{< tab name="JavaScript" >}}

```js
console.log("hello world")
```

{{< /tab >}}
{{< tab name="Go" >}}

```go
fmt.Println("hello world")
```

{{< /tab >}}
{{< /tabs >}}

群組

您可以選擇性地在 tabs 簡碼上指定一個索引標籤群組。這樣做將同步屬於同一個群組的所有索引標籤的選取狀態。

索引標籤群組範例

以下範例顯示了屬於同一個群組的兩個索引標籤區塊。


console.log("hello world")
fmt.Println("hello world")


const res = await fetch("/users/1")
resp, err := http.Get("/users/1")