<template>
	<view>
    <uni-icons  @click="getScanCode" style="margin-right: 10rpx" type="scan" size="25" color="#b9bcc5"/>

<!--    <view class="getScanCode" @click="getScanCode"></view>-->
	</view>
</template>

<script>
	export default {
		name: "yt-scanCode",
		props: {

		},

		data() {
			return {

			}
		},
		methods: {
			getScanCode() {
				uni.scanCode({
					onlyFromCamera: true,
					scanType: ['qrCode', 'barCode', 'dataMatrix'],
					success: res => {
						if(res.errMsg=='scanCode:ok'){
							this.$emit("getScanCode", res.result);
						}
						else
						{
							uni.showToast({
								title: '扫码失败',
								icon: "none",
								mask: true,
							})
						}
					},
					fail: err => {
						console.log("当前环境不支持！")
					}

				})
			},

		}
	}
</script>

<style>

</style>