【发布时间】:2021-10-23 05:53:32
【问题描述】:
我在做一个个人项目,但在使用 firebase 完成注册和登录表单时遇到了一些问题。我正在使用 Vuejs 和 TS,它向我抛出了这个错误。电子邮件另存为 txtEmail.value 和 txtPassword.value 的部分可以解决该错误。 这是一个sn-p:
const txtEmail = document.getElementById('email');
const txtPassword = document.getElementById('psw');
const btnLogin = document.getElementById('login');
const btnSignUp = document.getElementById('register');
const btnLogout = document.getElementById('logout');
btnLogin.addEventListener('click', e => {
const email = txtEmail.value;
const pass = txtPassword.value;
const auth = firebase.auth();
//Sign in
const promise = auth.signInWithEmailAndPassword(email, pass);
promise.catch(e => console.log(e.message));
});
【问题讨论】:
-
你检查过this answer吗?它也是一个 Vue CLI 应用程序,还是通过使用
<script>添加它来使用 VueJS 而不是 CDN?
标签: typescript firebase