gpt4 book ai didi

remove() function from firebase is not doing anything in addEventListener, despite correct specified location in firbase DB(尽管在Firbase DB中指定了正确的位置,但Firebase中的Remove()函数在addEventListener中不执行任何操作)

转载 作者:bug小助手 更新时间:2023-10-28 20:57:53 26 4
gpt4 key购买 nike



i've made a fucntion that when i click itemEl it should remove the item from fb database.
but whenever i click it i get the location of the element but the remove function doesnt seem to do anything... other than that i have no error code.

我已经做了一个功能,当我点击ItemEL时,它应该从FB数据库中删除该项目。但每当我单击它时,我都会得到元素的位置,但Remove函数似乎没有做任何事情……除此之外,我没有错误代码。


I am a newbie here so i'm probably missing something

我是这里的新手,所以我可能错过了什么


function addToShoppinglist(item) {
let ItemEl = document.createElement("li");

ItemEl.append(item)
shoppingListEl.append(ItemEl)


ItemEl.addEventListener("click", function() {
let exactLocationItem = ref(database, `items/${item}`);

console.log(exactLocationItem);


remove(ref(database, `items/${item}`));
});

it looks like everything is fine except that the remove function does nothing. all the console.log gets me what i (think) intend to get

看起来一切都很好,除了Remove函数什么也不做。所有的console.log都得到了我认为想要得到的东西


更多回答

I figured it out. getexactloactaion did not give me the location of the key whchi i needed but it give me the location of the item

我想通了。它没有给我我所需要的钥匙的位置,但它给了我物品的位置

优秀答案推荐
更多回答

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com