等待谷歌使用 firebase 登录并显示隐藏的 html 内容

问题描述

我想用 jquery 中的显示隐藏功能制作单页网页。 在文件 auth.js 中,我尝试像这样使用 firebase 进行 google 登录

function googleLogin() {
    const provider = new firebase.auth.GoogleAuthProvider();
    provider.setCustomParameters({
    prompt: 'select_account'
    });
    firebase.auth().signInWithPopup(provider)
    .then(result => {
    const user = result.user;
    console.log(user.displayName);
    LOGIN=true;
    })

然后,在 query.js 中,我想让 show hide 像这样的东西。

$(document).ready(function(){
    $('#login').show();
    $('#mypage').hide();

    $('#login').click(function(){

        if(LOGIN==true){
            $('#login').hide();
            $('#mypage').show();
        }
    })

但这不起作用,因为 jquery 不等待 google 登录

请帮忙!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)