vue 防抖优化

<template>
    <div class="default">
        <input type="text" v-model="keyword" @input="change">
    </div>
</template>

<script>
/**  @description:文件描述  **/
export default {
    name: '',
    components: {},
    data() {
        return {
            keyword:'',
            timer:''
        };
    },
    methods: {
        change(){
            clearInterval(this.timer)
            this.timer = setTimeout(() => {
                console.log(11)
            }, 500)
        }
    },
}
</script>

  

posted @ 2021-08-05 15:03  张健华  阅读(29)  评论(0编辑  收藏  举报