<el-slider v-model="value2"></el-slider>
watch: { value2: { deep: true, handler(oldValue, newValue) { this.sendPostMethods() } } }, methods:{ sendPostMethods(){ //这里POST请求,拖动slider滑块会发送很多个,如何cancel之前的,只保留最后一个 } }
去抖 _.debounce(func, [wait=0], [options={}])
_.debounce(func, [wait=0], [options={}])
methods:{ sendPostMethods: _.debounce(function sendPostMethods(){ //这里POST请求,拖动slider滑块会发送很多个,如何cancel之前的,只保留最后一个 }, 1000, {}) }
1.4m articles
1.4m replys
5 comments
56.7k users