所以我试图从网站上获取一些照片以创建画廊。 问题是当我想按作者排序时,我清空我的照片[]以在提取中重新填充照片。
sortByAuthor() {
console.log('Sort')
this.setPhotos([]); //Emptying
this.fetchGallery();
},
fetchGallery() {
const url = new URL('wtv');
const params = {
author: this.sortByAuthor ? this.sortByAuthor : '',
order: this.sortByDate,
limit: this.limit
};
url.search = new URLSearchParams(params);
fetch( url , {
method: 'GET',
}).then((response) => {
response.json().then((data) => {
this.fetchGallery(this.photos.length)
});
}).catch();
}
您将如何仅取消上一个感染?