61 lines
1.7 KiB
JavaScript
Raw Normal View History

2025-04-14 10:57:27 +08:00
"use strict";
const common_vendor = require("../../common/vendor.js");
if (!Array) {
const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
_easycom_uni_easyinput2();
}
const _easycom_uni_easyinput = () => "../../node-modules/@dcloudio/uni-ui/lib/uni-easyinput/uni-easyinput.js";
if (!Math) {
_easycom_uni_easyinput();
}
const _sfc_main = {
__name: "scanCode",
props: /* @__PURE__ */ common_vendor.mergeModels(["placeholder"], {
"modelValue": {
type: String
},
"modelModifiers": {}
}),
emits: /* @__PURE__ */ common_vendor.mergeModels(["scan-change"], ["update:modelValue"]),
setup(__props, { emit: __emit }) {
const code = common_vendor.useModel(__props, "modelValue");
const emit = __emit;
const onScan = () => {
common_vendor.index.scanCode({
onlyFromCamera: true,
//只能扫码
scanType: ["qrCode"],
success(res) {
const {
result
} = res;
code.value = result;
emit("scan-change", result);
},
fail(res) {
}
});
};
const onInput = (value) => {
if (value.detail.value == "")
return;
code.value = value.detail.value;
emit("scan-change", value.detail.value);
};
return (_ctx, _cache) => {
return {
a: common_vendor.o(onInput),
b: common_vendor.o(onScan),
c: common_vendor.o(($event) => code.value = $event),
d: common_vendor.p({
placeholder: __props.placeholder,
suffixIcon: "scan",
modelValue: code.value
})
};
};
}
};
wx.createComponent(_sfc_main);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/scanCode/scanCode.js.map