Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/410.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firestore/Javascript:Uncaught(承诺中)TypeError:未能在“节点”上执行“appendChild”:需要1个参数,但仅存在0个_Javascript_Html_Firebase_Google Cloud Firestore - Fatal编程技术网

Firestore/Javascript:Uncaught(承诺中)TypeError:未能在“节点”上执行“appendChild”:需要1个参数,但仅存在0个

Firestore/Javascript:Uncaught(承诺中)TypeError:未能在“节点”上执行“appendChild”:需要1个参数,但仅存在0个,javascript,html,firebase,google-cloud-firestore,Javascript,Html,Firebase,Google Cloud Firestore,我目前正在关注这一点,并严格遵循它,但调整了我的编码风格 我想做的是在我的网页上显示firestore子集合中名为patients的uid的某些字段。但我一直在犯错误 承诺类型错误中未捕获:未能在上执行“appendChild” “节点”:需要1个参数,但只存在0个 这与教程中显示的预期输出完全矛盾 这是我的密码: <div class="card"> <div class="card-body text-center">

我目前正在关注这一点,并严格遵循它,但调整了我的编码风格

我想做的是在我的网页上显示firestore子集合中名为patients的uid的某些字段。但我一直在犯错误

承诺类型错误中未捕获:未能在上执行“appendChild” “节点”:需要1个参数,但只存在0个

这与教程中显示的预期输出完全矛盾

这是我的密码:

        <div class="card">
            <div class="card-body text-center">
                <div class="card-body text-left">
                    <script>
                        firebase.auth().onAuthStateChanged(user => {
                        if(user){
                            this.userId = user.uid;
                        } //stores the user id in variable
                        const patientNames = document.querySelector('#patientList');

                        function renderPatientList(doc){
                            //var
                            let li = document.createElement('li');
                            let firstName = document.createElement('span');
                            let lastName = document.createElement('span');
                            let sex = document.createElement('span');


                            li.setAttribute('data-id', doc.id);
                            firstName.textContent = doc.data().firstName;
                            lastName.textContent = doc.data().lastName;
                            sex.textContent = doc.data().sex;

                            li.appendChild(firstName);
                            li.appendChild(lastName);
                            li.appendChild(sex);

                            patientNames.appendChild();
                        }
                            console.log(userId);
                            let userRef1 = firebase.firestore().collection("users").doc(userId).collection("patients");
                            return userRef1.get()
                            .then(function(querySnapshot) {
                                querySnapshot.forEach(function(doc) {
                                    // doc.data() is never undefined for query doc snapshots
                                    console.log(doc.id, " => ", doc.data());
                                    renderPatientList(doc);
                                });
                            });
                        });
                    </script>
                    <div>
                        <ul class id="patientList"></ul>
                    </div>
                </div> 
            </div>

这是在me patientNames.appendChild上作为错误抛出的代码

很抱歉,但我已经弄明白了!我忘了把李递给病人姓名;如果有人仍然有同样的问题,这就是答案

佩德奇尔利病人;应该是预期的参数