跳转到内容

富文本 RichText

富文本用于显示带自定义格式的文本内容

使用

import {RichText} from 'deft-react';
function App() {
const richTextRef = useRef();
useEffect(() => {
richTextRef.current.addLine([
{
type: "text",
text: "R",
color: "#F00",
weight: 'bold',
},
{
type: "text",
text: "ich",
weight: 'bold',
},
{
type: "text",
text: "T",
color: "#F00",
style: 'italic',
},
{
type: "text",
text: "ext",
style: 'italic',
}
]);
}, []);
return <RichText ref={richTextRef} />
}

属性

方法

方法说明返回值类型
addLine追加一行-
insertLine指定位置插入一行-
deleteLine删除指定行-
updateLine更新指定行-
clear清空文本-
measureLine测量指定文本尺寸-