1.可自主定义一个变量或者state来进行控制,当执行一次之后就把改变量设为0,就不会再次执行
//比对成功
if (this.state.count == 1) {
document.getElementById('facesuccess').play();
this.setState({ count: 0, isidentity: false, compareResult: true, previousDisabled: false }, () => {});
// newCamera('stopIdentity');
newCamera('closedevice');
}