html52.com
我爱小程序-开发者交流社区

为何input事件不能在父组件捕获?

问题模块
教程反馈

我个人的理解是,小程序中的事件都是从顶层组件往下传递,直到被catch为止。

而我在练习的时候感觉也是这样的,如果未被catch住,那么事件就会一直被capture到。

但是不知道为什么我尝试capture input控件的input事件时失败了。这是为什么?


下面是我写的代码

<view id="inner"capture-bind:input="handleInput">
  inner view
  <input/>
</view>
handleInput: function (evt){
    console.log('handleInput')
  }

当我在input控件输入的时候,控制台并没有输出。

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付