vue3中使用 lodash 中防抖函数

1.引入lodash 

npm i --save lodash

2.导入lodash  这里是全部导入 引用里面的 debounce

import {debounce} from "lodash";

3.使用 

// 调用鲁大师防抖函数  code 不能使用箭头函数,
const a =  debounce(code,600)

function code (){
  console.log('@@@@@@@@@@@',);
  clearInterval(timer)
  pheno.value=60
  timer= clearInterval(timer)
   timer =setInterval(()=>{
    pheno.value --
    
  if(pheno.value==-1){
    pheno.value ='获取验证码'
    clearInterval(timer)

  }
  },1000)

}

你可能感兴趣的:(前端,vue.js,javascript)