【问题标题】:error Property 'getItem' does not exist in type 'string'.ts(2339)错误“字符串”类型中不存在属性“getItem”.ts(2339)
【发布时间】:2022-01-21 02:02:25
【问题描述】:

我正在使用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`);
}

【问题讨论】:

    标签: angular typescript firebase


    【解决方案1】:

    您将uuid 定义为string 并在此字符串上调用.getItem('idCustomer')。但是,string 没有名为 getItem 的方法。

    (对我来说)您想要实现的目标非常不清楚。所以我可以告诉你出了什么问题,但没有关于如何解决根本问题的实际答案。

    【讨论】:

      猜你喜欢
      • 2021-01-10
      • 1970-01-01
      • 2023-01-10
      • 2019-08-11
      • 2021-08-02
      • 2020-06-02
      • 1970-01-01
      • 2022-07-09
      • 2022-10-04
      相关资源
      最近更新 更多