This commit is contained in:
aihe 2024-04-26 10:45:15 +08:00
parent 6168e1c43e
commit 4ca72eabcd
2 changed files with 6 additions and 7 deletions

View File

@ -122,9 +122,9 @@ const debounce = (fn, wait) => {
let callNow = !timer
timer = setTimeout(() => {
console.log('发送')
fn.apply(this, args)
timer = null
}, delay)
if (callNow) fn.apply(this, args)
}
}

View File

@ -15,16 +15,15 @@
</template>
<script>
import { throttle } from "@/common/util"
import { debounce } from "@/common/util"
export default {
watch: {
searchParam: {
handler(cval, oval) {
throttle(()=> {
this.getDataList(true)
}, 500)
},
handler: debounce(function(cval, oval) {
console.log("========qqqqqqqqqq")
this.getDataList(true)
}),
deep: true
}
},