| name |
description |
| jjb-cloud-component-props |
定义 JJB CloudComponent 组件完整属性说明与类型定义。在查阅 componentProps、dependencies、cache、headers 等属性时使用。 |
云组件使用规范
组件属性说明
CloudComponent Props
| 属性 |
类型 |
必需 |
默认值 |
描述 |
from |
string |
✅ |
- |
云组件资源地址(URL) |
componentKey |
string |
✅ |
- |
组件唯一标识,用于区分不同的云组件实例 |
componentProps |
Record<string, unknown> |
❌ |
{} |
传递给云组件的额外属性 |
dependencies |
Record<string, unknown> |
❌ |
{} |
组件依赖,会与默认依赖合并 |
cache |
CacheStrategy |
❌ |
'force-cache' |
缓存策略 |
headers |
Record<string, string> |
❌ |
{} |
请求头,用于需要认证的云组件资源 |
initialize |
boolean |
❌ |
false |
是否需要初始化更新 settings 和 dataSource |
componentRef |
React.Ref<Record<string, unknown>> |
❌ |
- |
组件引用,用于调用组件方法 |
onLoadStart |
() => void |
❌ |
- |
开始加载回调 |
onLoadEnd |
() => void |
❌ |
- |
加载完成回调 |
onMounted |
(key: string, ref: ComponentRef) => void |
❌ |
- |
组件挂载回调 |
onUpdated |
(key: string, ref: UpdateRef) => void |
❌ |
- |
组件更新回调 |
onDestroy |
() => void |
❌ |
- |
组件销毁回调 |
类型定义
// 缓存策略类型
type CacheStrategy =
| 'default'
| 'force-cache'
| 'no-cache'
| 'no-store'
| 'only-if-cached'
| 'reload';
// 组件引用类型
interface ComponentRef {
// 组件输出的表单配置
formItems?: Record<string, unknown>;
// 组件更新方法
updateData?: (settings?: Record<string, unknown>, dataSource?: unknown) => void;
}
// 更新引用类型
interface UpdateRef {
settings?: Record<string, unknown>;
dataSource?: unknown;
}