<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                簡單的理解方式就是:用戶多次觸發事件,在用戶一直觸發事件中,事件不會執行,只有在用戶停止觸發事件一段時間之后再執行這個事件一次。 ``` /** * @description 防抖函數 * @param {傳入的方法} fn * @param {延時時間} delay */ const debounce = (fn, delay = 300)=>{ let timer = null; return function debounce(...args) { return new Promise((resolve, reject) => { clearTimeout(timer); timer = setTimeout(() => { try { resolve(fn.apply(this, args)) } catch (e) { reject(e) } }, delay); }) } } //導出 module.exports = { debounce } ``` ``` 在wxs中引入 import {debounce} from '../../utils/util' //getSearchSuggest是接口調用方法,500ms只觸發一次 const debounceFun = debounce(getSearchSuggest,500); debounceFun(val.detail).then(res => { if (res.code == 200) { this.setData({ searchSuggest: res.result.allMatch.splice(0, 10) }) } }) ``` 效果圖:不會每次輸入完就調接口 ![](https://img.kancloud.cn/59/2d/592d89d59a8c4a85ed89dbf070eabed4_575x465.png)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看