选项卡
目录
选项卡组件由两个短代码组成
{{< 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")