[英]How to use Vue to call API when the focus leaves the input box?
my just encountered difficulties when learning vue,
and I don't know how to implement it.我刚在学习
vue,
时候遇到了困难vue,
不知道怎么实现。 I hope someone can help me!我希望有一个人可以帮助我!
First, I declare that my English is not good, but I try to express my problem completely.首先,我声明我的英语不好,但我尽量完整地表达我的问题。
The current project hopes to call the API after leaving the input box after entering the content in the input box, but I will only delay him by 0.4 seconds.当前项目希望在输入框中输入内容后离开输入框后调用API,但我只会延迟他0.4秒。 I don't know how to change the code to call the API when I leave the input box.
当我离开输入框时,我不知道如何更改代码以调用API。 I found an onBlur event on the Internet, but I still don't know how to write it, because I am really new to
vue
.在网上找了一个onBlur事件,但是还是不知道怎么写,因为我对
vue
真的很vue
。 I hope I can get your help.我希望我能得到你的帮助。 thank you.
谢谢你。
You only need to replace the @input
event with @blur
你只需要用
@blur
替换@input
事件
<el-input v-model="inputData" placeholder="Content" @blur="delayFetch" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.