/**
 * title: 基础
 * desc: 基本的操作演示
 */ import React , { useRef , useState } from 'react' ; import { Incubator , Button , Input } from '@rwp/react-ui' ; import { IncubatorHandle } from '@rwp/react-ui/dist/incubator' ; export default ( ) => { const [ url , setUrl ] = useState < string > ( ) ; const incubator = useRef < IncubatorHandle > ( null ) ; return ( < > < Input value = { url } placeholder = "请输入WORD的访问地址..." onChange = { ( text ) => { setUrl ( text ) ; } } /> < br / > < br /> < Button onClick = { ( ) => { incubator . current ?. openPreviewFile ( { fileName : 'test.docx' , targetUrl : url , } ) ; } } > 预览Word < /Button> < Button onClick = { ( ) => { incubator . current ?. openEditorFile ( { fileName : 'test.docx' , targetUrl : url , saveUrl : url } ) ; } } > 预览Word < /Button> < Incubator incubator = { incubator } downloadAddress = "http://127.0.0.1:8000/" / > < />); } ;