import * as React from 'react'; import { // getToUserId, getBSGlobal } from '&/helper'; interface SDKViewProps { iframeUrl: string; iframeCode: string; iframeId: number; } interface SDKViewState { } export default class SDKView extends React.Component { frameState = 0; iframeOnload = () => { console.log('onload') const { iframeUrl, iframeCode, iframeId } = this.props let data = { '__iTalentFrameId': 'iTalentFrame' //这里的id永远不能变,变会影响到italent sdk,这个id是iframe的Id , '__iTalentFrameType': 'iframe', '__iTalentLocationHref': '//' + location.host, '__iTalentWidgetUpdateSize': true, '__iTalentNavCode': iframeCode, '__iTalentNavId': iframeId, data: { 'iTalentFrame': iframeUrl, 'iTalentFrameType': 'iframe', 'iTalentNavId': iframeId, 'iTalentWidgetUpdateSize': true, 'iTalentNavCode': iframeCode } } if (this.frameState !== 0) return; this.frameState = 1; this.iframe.contentWindow.name = JSON.stringify(data); this.iframe.contentWindow.location.href = iframeUrl; } iframe: any render() { return ( ) } }