debounceTime在angular中的使用
- 在使用
angular
的时候,很多情况需要使用debounceTime
- 网上大多数的资料都是过时的,
rxjs
已经更新了,管道写法不一样了 - 新的写法
import { debounceTime } from 'rxjs/operators'
this.searchInput.valueChange
.pipe(debounceTime(300)) // 使用管道
.subscribe(
// 进行相应的操作
)
网友评论