Loadsh is used in vue to realize real-time retrieval, and arrow function is used to report errors.

use lodash plug-in to realize real-time retrieval of input and report errors

Page Code:

 <div class="search">
                <input type="text" v-model="condition" placeholder="" v-on:input="lodashSearch">
                <span class="search-icon" @click.stop="getSearchCommunity">
                    <i class="iconfont icon-w_search_normal"></i>
                </span>
            </div>

after downloading ladash dependencies using npm, introduce lodash

import _ from "lodash"

methods method:

    //
    
            lodashSearch: _.debounce(() => {
                this.getSearchCommunity(); // debounce
            }, 400),

error report:

clipboard.png


lodashresize
:


lodash?

:

clipboard.png
therefore the arrow function cannot be used in methods

May.22,2021

take a closer look at the documentation https://cn.vuejs.org/v2/api/-sharp.

Menu