欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

小程序报错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输入姓名时,报的错误

 

小程序报错Do not have xx handler in current page的解决方法

 

解决方法:排查

1、是否使用page()函数注册页面

小程序报错Do not have xx handler in current 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调整文件位置