<script setup lang="ts">

import { showToast } from 'vant'
import { onMounted } from 'vue'

onMounted(() => {
  navigator.mediaDevices.enumerateDevices().then((devices) => {
      devices.forEach((device) => {
        if (device.kind === "videoinput") {
          console.log(
            "Video input device: ",
            device.label,
            device.deviceId
          );
        }
      });
    })
    .catch((error) => {
      console.error("Error enumerating devices: ", error);
      showToast("Error enumerating devices");
    });
})

const onClickLeft = () =>{
  history.back()
}
const onClickRight=()=>{
}
const getResult = (val:any)=>{
  console.log(val)
}
const getError = (val:any)=>{
  console.log(val)
}
</script>

<template>
<view class="sys">
  <van-nav-bar
    title="白胚入库"
    left-text="返回"
    left-arrow
    right-text="新增"
    @click-left="onClickLeft"
    @click-right="onClickRight"
  />
  <BarScan @ok="getResult" @err="getError" ></BarScan>
</view>
</template>

<style scoped lang="scss">
.sys{
  width: 100vw;
  height: 100vh;
  background: #111;
}

</style>
