scanForPlugins 插件页面的扫一扫

scanForPlugins^8.2

插件页面的扫一扫

#请求参数

Prop Type Required Default Comment
types Array Y [] 定制扫一扫类型 1 扫条码 2 拍食材 3 扫食谱
defaultType Number N '2' 扫一扫类型默认选择拍食材

#接口调用示例

const params = {
  types: ["1", "2", "3"],
  defaultType: "1",
};
this.$bridge
  .scanForPlugins(params)
  .then((res) => {
    alert(res);
  })
  .catch((err) => {
    alert(err);
  });

#返回参数

  • 成功时返回
prop Type value comment
code Number 0 成功码
msg String 'xxxx' msg
type Number 1 1 扫条码;2 拍食材;3 扫食谱;
data String 'xxx' 条码值;食材图片 base64;食谱二维码

失败时(level 或者 message 为空或者没有)返回

Prop Type Value
code Number -1 摄像头没有权限
msg String 错误信息
posted on 2024-12-16 09:41  AtlasLapetos  阅读(5)  评论(0)    收藏  举报