import React,{Component} from ‘react‘ import ReactDOM,{render} from ‘react-dom‘ import ‘bootstrap/dist/css/bootstrap.min.css‘ // import PropTypes from ‘prop-types‘; import JSONP from ‘jsonp‘ //封装jonsp为promise对象 function jsonp(url,opts={}) { return new Promise((resolve,reject)=>{ JSONP(url,opts, (err,data)=> { if (err) reject(err); resolve(data); }) }) } class SearchCom extends Component{ constructor(){ super(); this.state={ val:"", arr:[], index:-1 } } handleChange = async (e)=>{ this.setState({val:e.target.value}); let {s} = await jsonp("https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?wd