admin管理员组

文章数量:1567016

[Vue warn]: Unhandled error during execution of native event handler

在@click中调用了异步函数

Good Code

const handleClick = async () => {
        await asyncFunction(param: YourParam).then(() => {
                //...
        }).catch(() => { }).finally(() => {
                //...
        })
}

Talk

个人菜鸟理解大概是vue或者ts警告异步函数没有规范处理抛出的异常,所以需要加上 .catch(() => {})以‘假’处理的方法来取消警告

Quote

typescript - How to properly handle rejection errors in async event listeners in Vuejs? - Stack Overflow

本文标签: UnhandledErrorvueWARNEvent