MM们
import { scanner } from 'scanner-js';class Home extends React.Component { constructor(props) { super(props); this.state = {}; } scan = () => { scanner.scan(this.displayImagesOnPage, { output_settings: [ { type: 'return-base64', format: 'jpg', }, ], }); }; displayImagesOnPage(successful, mesg, response) { if (!successful) { // On error console.error('Failed: ' + mesg); return; } if ( successful && mesg != null && mesg.toLowerCase().indexOf('user cancel') >= 0 ) { // User cancelled. console.info('User cancelled'); return; } var scannedImages = scanner.getScannedImages(response, true, false); // returns an array of ScannedImage for ( var i = 0; scannedImages instanceof Array && i < scannedImages.length; i++ ) { var scannedImage = scannedImages[i]; var elementImg = scanner.createDomElementFromModel({ name: 'img', attributes: { class: 'scanned', src: scannedImage.src, }, }); } } render() { return ( <div> <button type="button" onClick={this.scan}> Scan </button> </div> ); }}export default Home;当我将鼠标悬停在该scanner对象上时,会显示以下内容,但我不知道为什么它会抛出未定义的错误。有人可以帮我找到问题吗?