標籤頁
目錄
選項卡元件由兩個短程式碼組成
{{< 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")