Javascript TypeError:无法读取属性';使用电话号码'登录;未定义的

Javascript TypeError:无法读取属性';使用电话号码'登录;未定义的,javascript,firebase,vue.js,firebase-authentication,Javascript,Firebase,Vue.js,Firebase Authentication,结果已定义,但从未使用过错误发生,但我可以在代码中看到 另一个出现在控制台“无法读取属性”signInWithPhoneNumber“未定义” sendOTP(){ if(this.phoneNo.length!=10){ alert('Invalid No.'); }else{ let countryCode="+91" let phoneNumber=countryCode+ this.phoneNo

结果已定义,但从未使用过错误发生,但我可以在代码中看到

另一个出现在控制台“无法读取属性”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')
         })
     }
 },

关于第一个错误,这只是一个警告,您在某个地方定义了一个变量
result
,但没有使用它

此外,第二个错误是因为不存在
firebase.auth
,这可能通过导入它并按如下方式使用它来解决:

import Firebase from 'firebase';

我可以导入firebase,但我忘了编写everyLifOtp(){if(this.phoneNo.length!=10 | | this.otp.length!=6){alert('Invalid format')}否则{let vm=this let code=this.otp//var user window.confirmationResult.confirmationResult(code)}然后(函数(result){var user=user.result vm.$router.push({path:'/home'})}}},@AdiYadav yes您正在将它传入
then(函数(结果)
但从未使用过它。您可以删除它或在控制台中打印它,或者更改关于第二个问题的筛选规则将
auth
替换为
auth()
,并且不要忘记导入
firebase
您需要
()
auth
之后导入
firebase.auth()。登录电话号码(…)
firebase.auth().signInWithPhoneNumber...