我如何在async
函数上使用debounce
? 我的vue
-应用程序中有一个方法,该方法从API接收数据,并调用API以连续调用它,而我想避免这种情况。
以下是我的方法:
methods: {
async getAlbums () {
const response = await AlbumService.fetchAlbums()
this.albums = response.data.albums
}
}
我之前安装了 lodash
,那么我该如何实现它呢?
我之前已经安装了 lodash
,那么我应该怎样去实现它呢?
leading: true
立即调用了该方法,所以我们期望的 Promise 可用。不幸的是,lodash.debounce
在使用leading: true
时无法正常工作。https://dev59.com/3a7la4cB1Zd3GeqPg6du - Saman Mohamadi