数据类型

内容数据

uxEditor 所产生的数据是一系列内容项目的组合,简单的将一个完整的内容包含 :标题、文本、图片、链接等基本元素,这些元素在数据层面以 UXEditorItem 对象存储,最终组合为一个数组 UXEditorItem[],从而形成一个完整的内容。

在整个业务过程中我们还封装了多个数据类型,请阅读下面的介绍。

UXEditorItem 类型说明

UXEditorItem 类型用于存储内容项目数据,格式如下 :

export type UXEditorItem = {
	type:string
	content:string
	// 1 临时文件, 2 上传成功 3 上传错误
	uploadStatus:number
}

type 类型

类型作用
h标题
p段落文本
strong加粗文本
italic倾斜文本
center居中文本
blockquote引用文本
img图片
a链接
hr分割线

UXEditorItemForSubmit 类型

UXEditorItemForSubmit 是提交数据时,的项目基础数据类型,格式 :

export type UXEditorItemForSubmit = {
	type:string
	content:string
}

UXEditorNeedUploadItem 类型

UXEditorNeedUploadItem 是在提交时获取的需要上传的图片项目数据类型,格式:

export type UXEditorNeedUploadItem = {
	index:number
	tmpPath:string
}

UXEditorResponse 类型

UXEditorResponse 是统一的 API 接口返回数据的类型,格式:

export type UXEditorNeedUploadItem = {
	index:number
	tmpPath:string
}