标签页

选项卡组件由两个短代码组成

  • {{< 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")
© . This site is unofficial and not affiliated with Kubernetes or Docker Inc.