MCPcopy Create free account
hub / github.com/astercloud/aster / createPlaceholderConstructor

Function createPlaceholderConstructor

ui/src/protocol/standard-components.ts:137–151  ·  view source on GitHub ↗

* 创建占位符组件构造函数 * * 在实际的 Vue 渲染器实现之前,使用占位符构造函数注册标准组件。 * 这些占位符将在 Vue 组件实现后被替换。 * * @param typeName - 组件类型名称 * @returns 占位符组件构造函数

(typeName: string)

Source from the content-addressed store, hash-verified

135 * @returns 占位符组件构造函数
136 */
137function createPlaceholderConstructor(typeName: string): ComponentConstructor {
138 // 创建一个简单的 HTMLElement 子类作为占位符
139 const PlaceholderComponent = class extends HTMLElement {
140 static componentType = typeName;
141
142 connectedCallback() {
143 this.textContent = `[${typeName} placeholder]`;
144 }
145 };
146
147 // 设置类名以便调试
148 Object.defineProperty(PlaceholderComponent, 'name', { value: `${typeName}Placeholder` });
149
150 return PlaceholderComponent as unknown as ComponentConstructor;
151}
152
153/**
154 * 注册所有标准组件到注册表

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected