Skip to content

富文本输入

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

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

const model = ref({
	single: `<p><img class="wscnph" src="https://static.erp.91spyc.com/spider/4L6RHreUzIJVnJYxyzqEyDRDoWaUcN4vBAHamGIv.jpg" /><img class="wscnph" src="https://static.erp.91spyc.com/spider/qeAPu1h9YPnPsxHLxa2YpVNK37HsTxbLaziA4xIl.jpg" /><img class="wscnph" src="https://static.erp.91spyc.com/spider/6ruDTNLeydMh61GHsrlQsIqD2EkNIJOYvLx5rhpP.jpg" /></p>`,
	multiple: [],
});

const handleChange = (v) => {
    console.log('handleChange >>', v)
}

</script>

HTML富文本编辑器 API

<quill-editor> Props

参数名描述类型默认值
model-value (v-model)富文本内容string''
toolbar工具栏配置array[ ['bold', 'italic', 'underline', 'strike'], // toggled buttons ['blockquote', 'code-block'], [{ header: 1 }, { header: 2 }], // custom button values [{ list: 'ordered' }, { list: 'bullet' }], [{ script: 'sub' }, { script: 'super' }], // superscript/subscript [{ indent: '-1' }, { indent: '+1' }], // outdent/indent [{ direction: 'rtl' }], // text direction [{ size: ['small', false, 'large', 'huge'] }], // custom dropdown [{ header: [1, 2, 3, 4, 5, 6, false] }], [{ color: [] }, { background: [] }], // dropdown with defaults from theme [{ font: [] }], [{ align: [] }], ['clean'], ['image'], ]
theme富文本主题string'snow'
disabled是否禁用booleanfalse
placeholder占位符string''
accept图片格式string'image/jpeg, image/jpg, image/png'
multiple是否多选booleantrue
content-type内容类型string'html'

基于 MIT 许可发布