我收到错误“Uncaught TypeError: Cannot read property 'thumbnail' of undefined”,我不知道如何解决。我正在使用 Google Book API,但我收到了这个错误。我不明白这一点,因为在我使用缩略图之前,我检查了这个元素是否存在并且仍然得到这个错误。
JS:
if(Ui.checkIfExist(response.items[i].volumeInfo.imageLinks.thumbnail) &&
response.items[i].volumeInfo.imageLinks.thumbnail.length>0){
var img = document.createElement('div');
img.classList.add('img-book');
responseItem.appendChild(img);
img.innerHTML = "<img src=" + response.items[i].volumeInfo.imageLinks.thumbnail+">"+"</img>";
}