I want to change the URL based on what the user enters. The anti-shake function works fine. But I can't seem to access the "this" variable.
"this" implicitly has type "any" because it has no type annotation
searchbarPokemon: debounce(function (e: any) { this.$router.push(e.target.value); console.log(e) }, 1000)
And the data sent back by debounce is the last letter. Can I get a complete sentence?
EDIT: Found complete value at e.target.value
P粉9680081752023-09-07 15:38:08
You can create an arrow function to preserve this
' context:
searchbarPokemon: debounce((e: any) => { this.$router.push(e.target.value); console.log(e) }, 1000)