41 lines
1000 B
Vue
41 lines
1000 B
Vue
<template>
|
|
<view class="container">
|
|
<mumu-get-qrcode @success='qrcodeSucess' @error="qrcodeError"></mumu-get-qrcode> //插件
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import mumuGetQrcode from '@/uni_modules/mumu-getQrcode/components/mumu-getQrcode/mumu-getQrcode.vue' //引入
|
|
export default {
|
|
components: {
|
|
mumuGetQrcode //注册
|
|
},
|
|
data() {
|
|
return {
|
|
}
|
|
},
|
|
name: 'Qrcode',
|
|
methods: {
|
|
qrcodeSucess(data) { //摄像头扫码成功后返回
|
|
console.log(data,123)
|
|
uni.showModal({
|
|
title: '成功',
|
|
content: data,
|
|
success: () => {
|
|
console.log(111)
|
|
}
|
|
})
|
|
},
|
|
qrcodeError(err) { //摄像头扫码失败返回
|
|
uni.showModal({
|
|
title: '摄像头授权失败',
|
|
content: '摄像头授权失败,请检测当前浏览器是否有摄像头权限。',
|
|
success: () => {
|
|
console.log(222)
|
|
uni.navigateBack({}) //返回到上一页
|
|
}
|
|
})
|
|
}
|
|
}
|
|
};
|
|
</script> |