CondorEditor
CondorEditor 是一个基于 wangEditor 的富文本编辑器组件,支持文本格式化、图片上传、视频上传等功能。
组件 Props
| 参数名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| value | string / null | - | 必需 绑定的HTML内容,富文本HTML字符串 |
| height | number | 300 | 编辑器高度(像素) |
| disabled | boolean | false | 是否禁用编辑器(只读模式) |
| mode | 'default' / 'simple' | 'default' | 编辑器模式:- default: 完整模式 - simple: 简洁模式 |
| placeholder | string | placeholder | 编辑器占位文本 |
组件事件
| 事件名 | 说明 | 参数 |
|---|---|---|
| update:value | 当编辑器内容变化时触发 | 更新后的HTML字符串或null |
基础用法
1. 基本使用
vue
<template>
<div>
<h3>文章编辑</h3>
<CondorEditor v-model:value="content" />
<div class="preview" v-html="content"></div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
const content = ref('<h1>欢迎使用富文本编辑器</h1><p>这是一个示例内容</p>');
</script>2. 自定义高度和模式
vue
<template>
<div>
<CondorEditor
v-model:value="article"
:height="500"
mode="simple"
placeholder="请输入文章内容..."
/>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
const article = ref('');
</script>