求个节流,我这个没反应,不会节流
const onSubmit = async () => {
let timer = null;
if (timer) {
ElMessage({ message: '点太快了', type: 'warning' })
return clearTimeout(timer)
}
timer = await setTimeout(async () => {
const data = await axios.post('/adminapi/user/useredit', { username, form }).then(res => { return res.data })
if (data.status == 1) {
//成功
ElMessage({
message: data.message,
type: 'success',
duration: 1000
})
} else {
ElMessage({
message: data.message,
type: 'error',
duration: 1000
})
}
}, 1000)
}