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
814 B
Markdown
14 lines
814 B
Markdown
# RegisterFunction
|
|
|
|
## 控件功能,类型(普通控件或容器控件),父类控件
|
|
- **控件功能**:提供一个全局的函数注册与获取机制,用于管理和维护可复用的功能函数。通过名称注册函数,并可通过名称动态获取已注册的函数。
|
|
- **类型**:普通控件
|
|
- **父类控件**:无(原生 JavaScript 类)
|
|
|
|
## 初始化参数
|
|
- 无显式初始化参数。构造函数 `constructor()` 中初始化一个空对象 `this.rfs = {}`,用于存储注册的函数。
|
|
|
|
## 主要事件
|
|
- 无 DOM 事件。该控件主要提供以下方法作为接口:
|
|
- `register(n, f)`:将函数 `f` 以名称 `n` 注册到内部存储对象中。
|
|
- `get(n)`:根据名称 `n` 获取已注册的函数,若不存在则返回 `null`(捕获异常后处理)。 |