问题描述
在我的流星,我需要实现一个QR code扫描仪。
我试图使用科尔多瓦栏code扫描包流星。扫描仪是目前Android手机上运行良好。 但我的要求是把这个扫描仪内固定的div ,让其他的动作也可以保持执行其他功能。
例如,在屏幕的右上角,将有一个取消按钮,下面会有一些文本的报头,并低于应放在扫描器
这整个事情将是一个模板内。问题是,当我试图实现这一点,扫描仪占据了整个屏幕。我需要帮助来实现这一目标,我已搜查很多论坛,但未能找到了能够满足我的要求非常有用。
任何帮助将大大AP preciated。
这是我的模板:
<模板名称=home_modal>
{{> init_modal}}
{{> pay_modal}} < /模板> <模板名称=init_modal>
< DIV ID =modal2级=模式的家庭模式>
< DIV CLASS =模式内容>
&所述a取代;&下; H4类=中心模态-SCAN-完成>
扫描产品的code< / H4>
&所述; / A>
< DIV ID =QR扫描仪>
<输入类型=按钮值=取消/>
< / DIV> {{> scan_modal}} < / DIV>
< / DIV>
< /模板> <模板名称=scan_modal>
//渲染这个模板,科尔多瓦插件被称为
< /模板> <模板名称=pay_modal>
// code此模板放在这里
< /模板>
而在js文件
Template.scan_modal.rendered =功能(){
cordova.plugins.bar codeScanner.scan(
功能(结果){
Session.set('扫描code',result.text);
的console.log(Session.get('扫描code'));
},
功能(错误){
警报(扫描失败:+误差);
}
);
};
科尔多瓦栏code扫描插件是基于zxing和Android的控制传递给插件程序(即zxing)。在斑马线的应用程序,相机扫描占据整个屏幕,它的输出不是或不能被强迫到一个div或浏览器视图。
In my meteor, I need to implement a qr code scanner.I am trying to use cordova barcode scanner package for meteor. The scanner is running fine on the android phone. But my requirement is to put this scanner inside a fixed div, so that other actions can also be kept to perform other functions.
For example, at the top right corner in the screen, there will be a cancel button, and below that there will be an header with some text, and below that should be placed the scanner.
This whole thing will be inside a template. The problem is that when I am trying to implement this, the scanner is occupying the entire screen. I need help to achieve this goal, I have searched many forums but could not found something useful to meet my requirements.
Any help would be greatly appreciated.
Here is my template:
<template name="home_modal">
{{> init_modal}}
{{> pay_modal}}
</template>
<template name="init_modal">
<div id="modal2" class="modal home-modal">
<div class="modal-content">
<a><h4 class="center modal-scan-done">
Scan the product's Code</h4>
</a>
<div id="qr-scanner">
<input type="button" value="cancel"/>
</div>
{{> scan_modal}}
</div>
</div>
</template>
<template name="scan_modal">
//on rendering of this template , the Cordova plugin is called
</template>
<template name="pay_modal">
//code for this template goes here
</template>
And in the js file
Template.scan_modal.rendered = function () {
cordova.plugins.barcodeScanner.scan(
function (result) {
Session.set('scannedCode',result.text);
console.log(Session.get('scannedCode'));
},
function (error) {
alert("Scanning failed: " + error);
}
);
};
The cordova barcode scanner plugin is based on zxing and in Android the control is passed to the plugin app (ie zxing). In the zxing app, the camera scan takes over the entire screen and its output is not or cannot be forced into a div or browser view.
这篇关于MeteorJs把科尔多瓦栏code扫描仪固定DIV中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!