小程序报错Do not have xx handler in current page的解决方法
程序员文章站
2022-05-03 09:29:47
看到小程序这一大串的“Do not have bindName handler in current page: pages/card/card. Please make sure that bindName handler has been defined in pages/card/card, ... ......
看到小程序这一大串的“Do not have bindName handler in current page: pages/card/card. Please make sure that bindName handler has been defined in pages/card/card, or pages/card/card has been added into app.json”
惊不惊喜,意不意外?
我是input输入姓名时,报的错误
解决方法:排查
1、是否使用page()函数注册页面
2、添加获取值的方法
js:
//输入姓名 bindName: function (e) { let name = e.detail.value; this.setData({ usernameNew: name }) },
xml:
<view class="items-right"> <input bindinput="bindName" value="{{usernameNew}}" maxlength='7' placeholder-class='all-placeholder' placeholder='输入真实的姓名' class="right-print" type="text" name="usernameNew" type='text'> </input> </view>
3、再不济就在app.json调整文件位置
上一篇: 小刘同学的第一百二十一篇博文
下一篇: JSON学习笔记