我想將不同的 href 分配給表中的不同 td,該表根據從 firestore 提取的數據自動生成所述 td。這是我的 oferta.js,我可以毫無問題地從 firestore 檢索數據,但我真的不知道如何為 td“titulo”分配不同的 href,我嘗試使用錨點,但這會導致建立每個連續的 td 中都有相同的 URL,我該怎么做才能避免這個問題?提前感謝!const ofertaList = document.querySelector('#ofertaLista');const setupOferta = (data) => { let html = ''; data.forEach(doc => { const oferta = doc.data(); const td =` <tr> <td><a href="google.com">${oferta.titulo}</a></td> <td>${oferta.tipo}</td> <td>${oferta.fecha}</td> <td>${oferta.areaConocimiento}</td> <td>${oferta.cupoLimitado}</td> </tr> `; html += td }); ofertaList.innerHTML = html;}db.collection('oferta').get().then((snapshot) =>{ setupOferta(snapshot.docs)});
- 3 回答
- 0 關注
- 184 瀏覽
添加回答
舉報
0/150
提交
取消