"use strict"; const common_vendor = require("../common/vendor.js"); const _sfc_main = { setup() { let details = common_vendor.reactive({ activity: null, receiver: null, intentFilter: null }); common_vendor.onLoad(() => { initScan(); startScan(); }); common_vendor.onHide(() => { stopScan(); }); common_vendor.onUnload(() => { details.stopScan(); common_vendor.index.$off("scancodedate"); }); function initScan() { if (plus) { details.activity = plus.android.runtimeMainActivity(); var IntentFilter = plus.android.importClass("android.content.IntentFilter"); details.intentFilter = new IntentFilter(); details.intentFilter.addAction("android.intent.ACTION_DECODE_DATA"); details.receiver = plus.android.implements("io.dcloud.feature.internal.reflect.BroadcastReceiver", { onReceive: function(context, intent) { console.log("intent", intent); plus.android.importClass(intent); let content = intent.getStringExtra("barcode_string"); common_vendor.index.$emit("scancodedate", content.replace(/\n/g, "")); } }); } } function startScan() { details.activity.registerReceiver(details.receiver, details.intentFilter); } function stopScan() { details.activity.unregisterReceiver(details.receiver); } return { startScan, stopScan, initScan }; } }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return {}; } const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "F:/物流/logPm/compoment/saomiao1.vue"]]); wx.createComponent(Component);