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 let callNow = !timer
timer = setTimeout(() => { timer = setTimeout(() => {
console.log('发送') console.log('发送')
fn.apply(this, args)
timer = null timer = null
}, delay) }, delay)
if (callNow) fn.apply(this, args)
} }
} }

View File

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