import React from 'react'; export interface ScriptAttributes { id?: string; type?: string; async?: boolean; crossOrigin?: boolean; } export interface ScriptProps { url: string; beforeCode?: string; cancelable?: boolean; attributes?: ScriptAttributes; onCreate?: (url?: string, attributes?: ScriptAttributes) => void; onError?: (url?: string, attributes?: ScriptAttributes) => void; onLoad?: (url?: string, attributes?: ScriptAttributes) => void; onRemove?: (isRemoveBeforeCode: boolean, url?: string, attributes?: ScriptAttributes) => void; } /** * 动态创建和加载js文件,比如jquery */ export default class Script extends React.Component { static defaultProps: { beforeCode: string; cancelable: boolean; attributes: { async: boolean; }; onCreate: () => void; onError: () => void; onLoad: () => void; onRemove: () => void; }; componentDidMount(): void; componentDidUpdate(prevProps: ScriptProps): void; componentWillUnmount(): void; loadSrc: (isRefresh: boolean, preProps?: ScriptProps) => void; createScript(): void; render(): any; }