Child node 'click' event triggers no longer work when the parent becomes visible via $if
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript
- 领域
- frontend
调研方向
使用由 $if 控制的 #popup,并将 #button 作为其子元素,重现 issue 中的弹窗场景,比较初始可见与先隐藏后重新显示这两种情况。跟踪可见性变化如何影响子元素的事件处理;当父元素再次显示后按钮的 click 事件能够正常工作,同时 popup 和背景事件保持其报告的行为时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Use case: simple popup dialog with OK and CANCEL buttons. If the initial state of the popup is visible (for testing), the 'click' events on the buttons work as expected. If the popup node is set hidden via $if and then re-displayed ($if is true), the buttons (child nodes) no longer respond to click events.
FamousFramework.scene('tutaslabs:test', {
behaviors: {
'#popup': {
'align': [0.5, 0.3],
'origin': [0.5, 0.5],
'mount-point': [0.5, 0.5],
'size': [150, 150],
'position-z':1,
'style': {
'background-color': 'red',
'border-radius': '15px',
'padding': '20px'
},
'unselectable': false,
'$if': function(pvisible) {
return pvisible;
}
},
'#button': {
'align': [0.4, 0.4],
'origin': [0.5, 0.5],
'mount-point': [0.5, 0.5],
'size': [100, 30],
'position-z':20,
'style': {
'background-color': 'lightblue',
'border-radius': '15px',
'cursor':'pointer',
'text-align':'center',
'line-height':'30px'
},
'content': 'Ok'
}
},
events: {
'$self': {
'click': function($event,$state) {
alert('background clicked')
$state.set('pvisible',true)
}
},
'#button': {
//this does not work when parent becomes visible from a hidden state ($if was false)
'click': function($event,$state) {
alert('button clicked')
$state.set('pvisible',false)
}
},
'#popup': {
//this works as expected on becoming 'visible' ($if is true)
'click': function($event,$state) {
alert('popup clicked')
$state.set('pvisible',false)
}
}
},
states: {
pvisible: true
},
tree:
`<node id="popup">
<node id="button"></node>
</node>`
});
- 主要语言
- JavaScript
- 星标
- 394
- 派生
- 62
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Famous/framework 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 42/100
-
难度 4/5 3-5 天 新手友好度 20/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 5/5 一周以上 新手友好度 25/100
-
难度 5/5 一周以上 新手友好度 25/100
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 85/100
-
[quality] Nothing keeps docs/skills/manifest.md in sync with docs/skills/*.md可能已有人在做 @hivecommons-hive 今天认领。 未关闭agent/quality hive/covered-by-pr hive/hosted-available-lke648397-260827-5n31 quality testing
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
apache/rocketmq-dashboard#6610 ·
维护者通常 3 天内回复
-
documentation
难度 1/5 1 小时以内 新手友好度 95/100
githubnext/gh-aw-workshop#4535 ·
维护者通常 1 天内回复
-
Global update drops overrideAccess, so Local API updateGlobal fails filterOptions validation (3.90 regression)可能已有人在做 @PINYOPATTANAWASANPORN 今天认领。 未关闭area: core Bug
难度 2/5 1-3 小时 新手友好度 76/100
payloadcms/payload#18674 · 1 条评论 ·
维护者通常 1 天内回复