💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
[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) } } ~~~