自定义组件内动态添加的其他组件绑定事件无响应
自定义的弹层组件显示效果
自定义组件代码
< view class = "wx-popup" hidden = "{{flag}}" > < view class = 'popup-container' > < view class = "wx-popup-title" >{{title}}</ view > < view class = "wx-popup-con" > < checkbox-group bindchange = "checkboxChange"
> < label class = "checkbox" wx:for = "{{content}}" wx:key = "index" > < checkbox value = "{{item.code}}" /> < text >{{item.value}}</ text > </ label > </ checkbox-group > </ view > < view class = "wx-popup-btn" > < text class = "btn-ok" bindtap = '_success' >{{btn_ok}}</ text > </ view > </ view > </ view > |
index中引用代码:
< popup id = 'popup' title = '请选择标签' content = '' btn_ok = '确定' bind:error = "_error" bind:success = "_success" > </ popup > |
出现的问题:
自定义组件中包含的
<
checkbox-group
>元素,绑定事件bindchange=
"checkboxChange"
没有响应。试过即使换成button,绑定点击事件,在自定义组件内也一样无响应,不知道什么原因