想要在单击按钮时从Firebase添加更多图像我写了一个函数onLoadMore() {  if (this.all.length > 1 ) {    const lastLoadedPost = _.last(this.all);    const lastLoadedPostKey = lastLoadedPost.key;    this.loadMoreRef = firebase.database().ref('allposts').startAt(lastLoadedPostKey, lastLoadedPost).limitToFirst(7);    this.loadMoreRef.on('child_added', data => {      if ( data.key === lastLoadedPostKey ) {        return;      } else {        this.all.push({          key: data.key,          data: data.val()        });      }    });  }  }但是当我单击按钮控制台向我显示此错误时,Query.startAt失败:第二个参数是无效的键=“ [object Object]”。Firebase密钥必须是非空字符串,并且不能包含“。”,“#”,“ $”,“ /”,“ [”或“]”)。单击按钮时,我想添加更多图像,但我不想重复现有图像
                    
                    
                1 回答
                            郎朗坤
                            
                                
                            
                        
                        
                                                
                    TA贡献1921条经验 获得超9个赞
要在按键订购时获得下一页的项目,您需要:
this.loadMoreRef = firebase.database().ref('allposts').orderByKey().startAt(lastLoadedPostKey).limitToFirst(7);请注意此帖子有关以下内容的第二个参数的含义startAt:Firebase orderByChild,带有startAt()的第二个参数,带有分页,不排序
添加回答
举报
0/150
	提交
		取消
	