You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
fude/pages/ScanningCode/index.vue

46 lines
735 B

<template>
<view class="index">
</view>
</template>
<script>
export default {
data() {
return {
}
},
onTabItemTap() {
this.getScanHandle()
},
methods: {
getScanHandle(){
uni.scanCode({
success: function(res) {
console.log(res,"成功")
if(res.result){
uni.navigateTo({
url:'/pages/index/add?barcode='+res.result
})
}
},
fail:function(res) { // 取消操作后的回调 跳转到小程序首页
uni.switchTab({
url:'/pages/index/index'
})
console.log(res,"失败")
}
});
}
},
}
</script>
<style lang="scss" scoped>
.index{
min-height: calc(100vh);
background-color: #F4F5F7;
}
</style>