Skip to content

Commit fcdc1a1

Browse files
authored
feat: add more expose methods for apiComponent (vbenjs#5958)
* 为ApiComponent组件添加getOptions和getValue导出方法。
1 parent bf7496f commit fcdc1a1

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

docs/src/components/common-ui/vben-api-component.md

+2
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,5 @@ function fetchApi(): Promise<Record<string, any>> {
169169
| --- | --- | --- | --- |
170170
| getComponentRef | 获取被包装的组件的实例 | ()=>T | >5.5.4 |
171171
| updateParam | 设置接口请求参数(将与params属性合并) | (newParams: Record<string, any>)=>void | >5.5.4 |
172+
| getOptions | 获取已加载的选项数据 | ()=>OptionsItem[] | >5.5.4 |
173+
| getValue | 获取当前值 | ()=>any | >5.5.4 |

packages/effects/common-ui/src/components/api-component/api-component.vue

+4
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ function emitChange() {
242242
}
243243
const componentRef = ref();
244244
defineExpose({
245+
/** 获取options数据 */
246+
getOptions: () => unref(getOptions),
247+
/** 获取当前值 */
248+
getValue: () => unref(modelValue),
245249
/** 获取被包装的组件实例 */
246250
getComponentRef: <T = any,>() => componentRef.value as T,
247251
/** 更新Api参数 */

0 commit comments

Comments
 (0)