[英]TypeError: Cannot read property 'signInWithPhoneNumber' of undefined
结果已定义但从未使用过错误发生但我可以在代码中使用查看。
另一个发生在控制台'无法读取未定义的属性'signInWithPhoneNumber''
sendOTP(){
if(this.phoneNo.length!=10){
alert('Invalid No.');
}else{
let countryCode="+91"
let phoneNumber=countryCode+ this.phoneNo
let appVerifier=this.appVerifier
firebase.auth.signInWithPhoneNumber(phoneNumber, appVerifier)
.then(function (confirmationResult){
window.confirmationResult=confirmationResult;
alert('SMS sent')
}).catch(function(){
alert('SMS not sent')
})
}
},
关于第一个错误,它只是一个 linting 警告,您在某处定义了一个变量result
并且您没有使用。
而且,第二个错误是因为firebase.auth
不存在,大概可以通过如下方式导入使用解决:
import Firebase from 'firebase';
firebase.auth().signInWithPhoneNumber...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.