我想根据用户输入的内容更改 URL。 防抖功能工作正常。但我似乎无法访问“this”变量。
“this”隐式具有类型“any”,因为它没有类型注释
searchbarPokemon: debounce(function (e: any) { this.$router.push(e.target.value); console.log(e) }, 1000)
而且去抖动发回的数据是最后一个字母。可以得到完整的句子吗?
编辑:在e.target.value处找到完整值
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
您可以创建一个箭头函数来保留
this
'上下文: