web建站教程
  1. 首页
  2. vuejs
  3. js
  4. 好玩
  5. seo教程
  6. 前端知识
  7. 百度echarts
  8. 更多
    php入门
    nodejs
    mockjs
    reactjs
    mysql
    wordpress
    织梦cms
    帝国cms
    git教程
    IT知识
    模板大全
    休息站

uniapp语法实现扫码枪自带条码读取代码

145 ℃
     
//监听扫码枪事件源码
class pdaScan {
  constructor(onReceive){
    this.main
    this.filter
    this.receiver
    this.init(onReceive)
    this.start = this.start
    this.stop = this.stop
  }

  init(onReceive){
    this.main = plus.android.runtimeMainActivity();
    const IntentFilter = plus.android.importClass('android.content.IntentFilter');
    this.filter = new IntentFilter();


    this.filter.addAction("com.scanner.broadcast");
    this.receiver = plus.android.implements('io.dcloud.feature.internal.reflect.BroadcastReceiver', {
      onReceive: (context, intent) => {
        plus.android.importClass(intent);

        const code = intent.getStringExtra("data");
        onReceive && onReceive(code);
      }
    });
  }
  start(){
    this.main.registerReceiver(this.receiver, this.filter);
  }
  stop(){
    this.main.unregisterReceiver(this.receiver);
  }
}
export default pdaScan

uniapp微信小程序鼠标点击input placeholder出现位移解决方法

uniapp如何实现扫码枪自带条码读取功能(附vue.js具体代码)

uniapp分包加载有什么好处,uniapp分包教程实例代码

uniapp打包后,打开app有忽略版本检查提示框解决方法

uniapp语法如何动态配置路由信息

标签: uniapp教程, uniapp语法, 扫码枪功能

上面是“uniapp语法实现扫码枪自带条码读取代码”的全面内容,想了解更多关于 js 内容,请继续关注web建站教程。

当前网址:https://ipkd.cn/webs_15575.html

声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

当前位置: 网站首页 > js
本文共计718个字,预计阅读时长5分钟
生活小工具,收录了80多款小工具
上一篇: 推荐一款由字制区设计团队的免费综艺字体——字制区喜脉体
下一篇: 推荐一款免费开源的跨平台MarkDown编辑器——Mark Text
x 打工人ai神器