watch {
searchVal (newVal, oldVal) {
if (this.timer) {
clearTimeout(this.timer)
}
this.timer = setTimeout(() => {
// 发送请求
this.getList(newVal)
}, 300)
}
}

优化

watch {
searchVal (newVal, oldVal) {
this.timer && clearTimeout(this.timer)
this.timer = setTimeout(() => this.getCards(newVal), 300)
}
}