createRoot(document.getElementById("app")!).render( <Annotation onChange={(annos) => { console.log({ annos }); }} tags={[{ content: "error" }, { content: "success" }]} sentence="A story is a component with a set of arguments that define how the component should render." /> ); exportdefaultApp;
参数说明
sentence:需要进行标注的文本内容。
onChange:标注完成后的回调函数,返回当前所有标注结果。
tags:自定义打标内容。
更多参数
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
exportinterfacePAnnotation { /** content to be showed */ sentence?: string; tags?: TTag[]; /**the annotations that already exist */ annoations?: TAnnoDetail[]; /**the fontSize of main content,now only support number, will use px unit */ fontSize?: number; /** Ensure that there is enough space between the rows to fit a tag */ lineHeight?: string; /** the color of marked text by annotation */ hightlightColor?: string; hightlightBgColor?: string; /** can not mark */ readonly?: boolean; /** notify when annotations add or remove */ onChange?: (annoations: TAnnoDetail[]) =>void; }