此页内容

代码组

pengzhanbo

136字小于1分钟

2024-04-04

语法

可以像这样对多个代码块进行分组:

输入:

::: code-tabs
@tab config.js
```js
/**
 * @type {import('vuepress').UserConfig}
 */
const config = {
  // ..
}

export default config
```

@tab config.ts
```ts
import type { UserConfig } from 'vuepress'

const config: UserConfig = {
  // ..
}

export default config
```
:::

输出:

config.js
/**
 * @type {import('vuepress').UserConfig}
 */
const config = {
  // ..
}

export default config

你还可以通过 @tab:active 选择其中一个代码块作为默认显示的代码块。