| 123456789101112131415161718192021222324252627282930313233 |
- // #ifdef APP-PLUS
- const shangMiPrint = uni.requireNativePlugin('G5KJ-ShangMiPrint')
- const globalEvent = uni.requireNativePlugin('globalEvent')
- export default {
- data() {
- return {
- }
- },
- created(){
- this.listenScan()
- },
- methods: {
- listenScan(){
- let that = this
- //商米收银台
- if(plus.device.vendor == 'SUNMI'){
- //https://ext.dcloud.net.cn/plugin?id=3514
- //初始化
- shangMiPrint.init()
- //扫码返回
- globalEvent.addEventListener('scancode',function(e){
- if(e.code == 'ok'){
- let productIdCode = e.data
- //that.$msg(productIdCode)
- uni.$emit('listenGetScanCode',{code:productIdCode})
- }
- })
- console.log('商米监听扫码...')
- }
- }
- }
- }
- // #endif
|