function handleClear(){ console.lo var scan=document.getElementById("scanId") scan.text="" } let scanner = null; let callback = null; function onmarked(type, result){ scanner.cancel(); scanner.close(); scanner = null; console.log('result is' + type + result); callback(result); } function scanCB(){ console.log('get scan result'); } window.destroyScan = function(){ scanner.cancel(); scanner.close(); scanner = null; } window.startRecognize = function(cb){ callback = cb; let w = window.innerWidth; if(!scanner){ console.log(1111) scanner = new plus.barcode.Barcode('barcode', [], { top: '100px', left: '0px', width: w, height: '500px' }); //plus.barcode.create('barcode', [plus.barcode.QR], // { // top: '100px', // left: '0px', // width: w, // height: '500px' // }) scanner.onmarked = onmarked; plus.webview.currentWebview().append(scanner); console.log(1222) } }