Uncaught TypeError: XXX is not a function解决

后台没有错误,前端一直显示 Uncaught TypeError: withdraw is not a function 错误,代码如下:

<div class="form-group btn-right">
    <button type="button" class="btn btn-primary" id="withdraw" onclick="withdraw();">提现</button>
</div>

出现这样的错误是因为 button控件的 id 名和 函数名相同了,执行的时候先找到的是HTML控件,所以会报这样的错误,修改其中一个名称就OK了。

Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐