<!-- <view class="container">
</view> -->
</template>
<script>
export default {
data() {
return {
barcode:null
}
},
methods: {
creatQRBox() {
var pages = getCurrentPages()
var page = pages[pages.length - 1]
// #ifdef APP-PLUS
var currentWebview = page.$getAppWebview() //获取当前页面栈
console.log(currentWebview)
// #endif
this.barcode = plus.barcode.create("barcode", [plus.barcode.QR], {
top: '0rpx',
left: '0rpx',
width: '300rpx',
height: '300rpx',
position: 'static'
})
currentWebview.append(this.barcode);
this.barcode.onmarked = this.onmarked
// this.startQR()
this.barcode.start()
},
onmarked(type, code, file) {
console.log(type, code, file);
uni.navigateTo({
url:'../orderList/orderdetails'
})
this.barcode.cancel()
// this.closeQR()
},
},
mounted() {
this.creatQRBox()
// this.start()
},
onShow() {
// console.log(this.barcode)
if(this.barcode==null){
return
}
this.barcode.start()
},
onHide() {
console.log('消失')
this.barcode.cancel()
console.log(this.barcode)
// this.closeQR()
}
}
</script>
<style lang="scss" scoped>
// .container {
// width: 750rpx;
// min-height: 100vh;
// background-color: #FFFFFF;
// }
</style>