Skip to content

Code 代码块 ​

代码展示组件,支持语言标识、复制按钮、暗色主题、内联代码。

基础用法 ​

vue
<template>
  <parrot-code code="const msg = 'Hello'" lang="ts" />
</template>

内联代码 ​

vue
<parrot-text>使用 <parrot-code inline code="npm install parrotui" /> 安装</parrot-text>

API ​

Props ​

属性类型默认值说明
codestring''代码内容
langstring''语言
copyablebooleantrue复制按钮
inlinebooleanfalse内联模式

Events ​

事件说明回调参数
copy复制成功(code)
9:41

Released under the MIT License.