打开页面代码:
mui.openWindow({
url: 'scan.html',
id: "scanPage",
show: {
aniShow: 'pop-in'
},
createNew: true,
styles: {
popGesture: 'hide'
},
waiting: {
autoShow: false
},
extras: {
PWebviewId: "home/index.html"
}
});
扫码代码:
mui.init();
mui.plusReady(function() {
document.getElementById('cancel').addEventListener('tap', function() {
mui.back();
});
var scan = new plus.barcode.Barcode('bcid', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]);
scan.onmarked = function(type, result, file) {
result = result.replace(/\n/g, '');
var w = mui.currentWebview;
var m = plus.webview.getWebviewById(w.PWebviewId);
mui.fire(m, 'onScanAfter', {
Result: result
});
mui.back();
scan.cancel();
scan.close();
};
scan.start({
conserve: true,
filename: "_doc/barcode/"
});
});