Skip to content

富文本输入

代码事例
vue
<template>
	<h2>编辑状态</h2>
	<RichTextInput v-model="model.single" :imageMenus="imageMenus" />
	<fk-row>
		<JsonViewer :data="model" />
	</fk-row>
</template>

<script lang="ts" setup>
import { ref } from 'vue';
import { RichTextInput } from '@erp/biz';

const model = ref({
	single: `<div dir="auto" data-component="RootComponent" class="xnote-root"><div data-placeholder="" class="xnote-content"><div data-component="ParagraphComponent" class="xnote-paragraph"><div><br /></div></div></div></div>`,
	multiple: [],
});
const imageMenus = [{
    label: '本地上传',
    value: 'Local',
    click({ uploadImage }) {
        uploadImage();
    }
}, {
    label: '图片空间',
    value: 'ImageSpace',
    hideMenu: true,
    click({insertImage}) {
        insertImage('https://test.img.fukerp.com/default/AkvxvTvW7QH7GrZGzH7Gcj2FC6EeUQttwudzaPqN.jpg')
    }
}]

</script>

富文本 API

<rich-text-input> Props

参数名描述类型默认值
model-value (v-model) (必填)富文本内容string-
disabled是否禁用booleanfalse
file-upload文件上传配置SelectFileProps-

SelectFileProps

参数名描述类型默认值
name上传名称string-
action上传地址string-
acceptword excel ppt pdf image audio videostring | string[]-
maxSizemaxSize M为单位number-
data附加的请求信息Record<string, string | Blob> | ((fileItem: FileItem) => Record<string, string | Blob>)-

基于 MIT 许可发布