vue-camera,一个自己写的vue插件,getusermedia调用摄像头拍照与生成canvas, 毕设做完会继续填坑~~
npm install vue-camera
组件调用
<template>
<div>
<Camera/>
</div>
</template>
import camera from 'vue-camera'
export default {
name: 'app',
components: {
Camera
}
}
Props
props: {
ow: {
type: [Number, String],
default: 400
},
oh: {
type: [Number, String],
default: 300
},
fillColor: {
type: String,
default: '#000'
},
placement: {
type: String,
default: '请点击打开摄像头'
},
maxView: {
type: Number,
default: 10
}
}
this.$emit('error', err); // 错误
this.$emit('tocanvas', dataUrl) // 拍照生成canvas