企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
[TOC] #### 搜索节流 created() ~~~ import { debounce } from 'common/js/helpers' created() { // 监听query数据 this.$watch('content', debounce((newVal) => { this.$emit('inputVal', newVal) },200)) }, ~~~ >[danger] debounce 为节流函数 debounce ~~~ export function debounce (func, delay) { let timer return function (...args) { if (timer) { clearTimeout(timer) } timer = setTimeout(() => { func.apply(this, args) }, delay) } } ~~~