30 lines
589 B
Vue
30 lines
589 B
Vue
<template>
|
|
<view>
|
|
<uni-easyinput class="uni-mt-5" :value="code" placeholder="请扫码或输入头盔编号" suffixIcon="scan" @iconClick="onscan" @change="$emit('scanchange')">
|
|
</uni-easyinput>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import {ref} from 'vue';
|
|
const props = defineProps({
|
|
scanchange: Function
|
|
});
|
|
|
|
const code = defineModel({type:String});
|
|
|
|
const onscan= ()=>{
|
|
uni.scanCode({
|
|
onlyFromCamera: true, //只能扫码
|
|
scanType: ["qrCode"],
|
|
success: function(res) {
|
|
const {result} = res;
|
|
code.value=result;
|
|
}
|
|
})
|
|
};
|
|
|
|
</script>
|
|
|
|
<style>
|
|
</style> |