0.1.2 • Published 2 years ago

dmp-rsc v0.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

��# dmp-rsc(https://gitlab.mypaas.com.cn/dmp/dmp-rsc) ,gy��v:Npe��US�V2n�g�~�N - git0W@W: https://gitlab.mypaas.com.cn/dmp/dmp-rsc ##�[ň shell # npm npm install dmp-rsc # yarn yarn add dmp-rsc ## �OP[ typescript jsx // react import dmpRsc from 'dmp-rsc' // token, requestUrl, chartId ����cMR�QY}Y const Chart = ({ token, requestUrl, chartId }) => { const container = useRef() useEffect(() => { // R�YS token�T��Blurl dmpRsc.init({ token, requestUrl }) // 2n�g dmp.rsc({ contianer: container.current, chartId }) // xS}� return () => { dmpRsc.unmount() } }, [token, requestUrl, chartId]) return ( <div ref={container} style={{ width: '300px', height: '200px'}} /> ) } ## API ### init R�YSUS�V�~�N ��OX[token�T��Blurl typescript jsx interface IOption { token: string; requestUrl: string; } interface IInit { (option: IOption): void } O(u javascript dmpRes.init({ token: '[token]', requestUrl: 'https://dmp-test.mypaas.com.cn/api' }) tokenub�e_T��|pe��T�z�V� --- ### render 2n�gUS�V�~�N typescript jsx interface IOption { container: Container | null; chartId: string; } interface IRender { (option: IOption | IOption[]): void } O(u javascript // US*N�~�N dmpRsc.render({ chartId: '[chartId]', contianer: document.getElementById('containerId'), }) // Y*N�~�N dmpRsc.render([ { chartId: '[chartId]', contianer: document.getElementById('containerId1'), }, { chartId: '[chartId]', contianer: document.getElementById('containerId2'), } ]) chartId���S�e_T��|pe��T�z�V� --- ### unmount xS}��~�N typescript jsx interface unmount { (): void } O(u typescript jsx dmpRsc.unmount()