Home  >  Article  >  WeChat Applet  >  Does the mini program have a scanning function?

Does the mini program have a scanning function?

angryTom
angryTomOriginal
2020-03-20 17:19:076520browse

Does the mini program have a scanning function?

Does the mini program have a QR code scanning function?

The mini program has a QR code scanning function. For specific usage methods, please refer to the WeChat mini program development documentation , only a brief introduction is given here.

You can use the mini program to call the code scanning functionwx.scanCode(Object object)

The parameters are as follows:

##successfunctionNoCallback function for successful interface callfailfunctionNoCallback function for failed interface callcompletefunctionNoThe callback function at the end of the interface call (will be executed if the call is successful or failed)
AttributeTypeDefault valueRequiredDescriptionMinimum version
onlyFromCamerabooleanfalseNoWhether the code can only be scanned from the camera, not allowed from Album selection picture1.2.0
scanTypeArray.98c455a79ddfebb79781bff588e7b37e['barCode', 'qrCode ']NoScan code type1.7.0






Sample code:


// 允许从相机和相册扫码
wx.scanCode({
  success (res) {
    console.log(res)
  }
})

// 只允许从相机扫码
wx.scanCode({
  onlyFromCamera: true,
  success (res) {
    console.log(res)
  }
})

PHP Chinese website, a large number of

small program development, welcome study!

The above is the detailed content of Does the mini program have a scanning function?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn