欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

如何在uniapp中轻松实现二维码扫描功能 (uni.scanCode指南)

最编程 2024-02-22 07:19:51
...
<template> <view class="scanCodeBox"> <image class='imgCode' src="../static/code.png" mode="" @click="scanCode"></image> <view class="desc"> 扫一扫 </view> </view> </template> <script> export default { methods: { // 点击扫一扫按钮 scanCode() { uni.scanCode({ success: (res) => { console.log('扫码成功', res) }, fail: (err) => { console.log('扫码失败', err) }, complete: () => { console.log('扫码结束') } }) }, } } </script>