错误 类型"字符串"中不存在属性'getItem'.ts(2339)



我正在使用firebase在网站上注册链接,我试图传递uuid来创建一个子集合,但没有成功,会是什么??

constructor(private af: AngularFirestore) {}
async add(urls: Urls, uuid: string): Promise<void> {
await this.af.collection(`${this.collection}/${uuid.getItem('idCustomer')}/menu`).add({ ...urls });
await this.getUrls(`${this.collection}/${uuid.getItem('idCustomer')}/menu`);
}

您将uuid定义为string,并在此字符串上调用.getItem('idCustomer')。然而,string不具有称为getItem的方法。

(我(很不清楚你想达到什么目的。所以我可以告诉你出了什么问题,但没有关于如何解决根本问题的实际答案。

最新更新