<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>
