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