When valueField/textField are not explicitly set in opts, the auto-select logic (line 1140) and nullable empty-option creation (lines 1144-1145) used data[0][undefined] which returned undefined, causing: - Single-option selects to show blank (auto-select failed) - nullable empty options to have undefined keys Now extracts vf/tf local variables with ||'value'/||'text' fallback at the top of build_options(), used consistently throughout.
14 lines
508 B
Markdown
14 lines
508 B
Markdown
# KeyPress
|
||
|
||
控件功能:监听键盘按键事件,当用户按下任意键时,清除当前内容并显示按下的键名。
|
||
类型:容器控件
|
||
父类控件:VBox
|
||
|
||
## 初始化参数
|
||
|
||
- 无特殊初始化参数,继承自 `bricks.VBox` 的通用参数(如布局相关选项等)。
|
||
|
||
## 主要事件
|
||
|
||
- `keydown`:绑定全局键盘按下事件,触发 `key_handler` 方法处理按键逻辑。
|
||
在该事件中获取 `event.key` 值,并动态创建显示按键信息的文本控件。 |