第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用拼接從數(shù)組中刪除元素

使用拼接從數(shù)組中刪除元素

梵蒂岡之花 2021-10-14 16:59:04
假設(shè)我有一個回應(yīng)我正在循環(huán)它并將 pic.id 推送到文件數(shù)組上files = []response.data[0].pics.forEach(function(pic, i){      let div = makeButtons(response.data[0].pics, files, imgPrevEdit);      files.push(pic.id);});所以推送文件數(shù)組后會變成這樣make 按鈕函數(shù)用于使用 splice 函數(shù)刪除數(shù)組上的某個元素makeButtons: function(file, store, elem) {    let button = document.createElement("button");    button.classList.add('position-absolute','x', 'rounded-circle');    button.type = "button";    button.innerHTML= "x";    button.addEventListener('click', () => {        elem.removeChild(div);        store.splice(store.indexOf(file), 1);    });    let div = document.createElement("div");    div.classList.add('col', 'mt-2');    div.appendChild(button);    return div;},但是,當(dāng)我單擊按鈕時,它總是從文件數(shù)組的末尾開始,它找不到特定的鍵并將其刪除知道我該如何解決嗎?
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 141 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號