💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
**效果图**如下: ![](https://box.kancloud.cn/3d38ccb52c8647b105249471ce80c293_375x516.png) **代码**如下: ``` <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>Hello React!</title> <script src="https://cdn.staticfile.org/react/16.4.0/umd/react.development.js"></script> <script src="https://cdn.staticfile.org/react-dom/16.4.0/umd/react-dom.development.js"></script> <script src="https://cdn.staticfile.org/babel-standalone/6.26.0/babel.min.js"></script> <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script> </head> <body> <div id="example"></div> <script type="text/babel"> class Clock extends React.Component{ constructor(props){ super(props); this.state={ title:"hello world", imgUrl:"" } } render(){ return( <div> <h1>{this.state.title}</h1> <img src={this.state.imgUrl} /> </div> ) } componentDidMount(){ var url = "https://api.douban.com/v2/movie/top250"; $.ajax({ url, type:"get", dataType:"jsonp", success: res=> { /* console.log(res); */ var subjects = res.subjects[0]; var title = subjects.title; var imgUrl = subjects.images.small; this.setState(()=>{ return { title, imgUrl } }) } }) } } ReactDOM.render( <Clock />, document.getElementById('example') ); </script> </body> </html> ```