|
@@ -316,6 +316,7 @@ export default {
|
|
this.run();
|
|
this.run();
|
|
},
|
|
},
|
|
beforeDestroy() {
|
|
beforeDestroy() {
|
|
|
|
+ this.closeCamera();
|
|
this.$Spin.hide();
|
|
this.$Spin.hide();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -1051,6 +1052,16 @@ export default {
|
|
throw "同步照片比较失败!";
|
|
throw "同步照片比较失败!";
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ closeCamera: function() {
|
|
|
|
+ console.log("关闭摄像头");
|
|
|
|
+ const video = document.getElementById("inputVideo");
|
|
|
|
+ if (video.srcObject) {
|
|
|
|
+ video.srcObject.getTracks().forEach(function(track) {
|
|
|
|
+ track.stop();
|
|
|
|
+ });
|
|
|
|
+ video.srcObject.srcObject = null;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|