fix: 兼容原来 prototype 的 componentName/view

This commit is contained in:
力皓 2020-08-20 20:12:44 +08:00
parent c69f5fac43
commit d542a404ce
2 changed files with 8 additions and 1 deletions

View File

@ -220,6 +220,11 @@ class Prototype {
readonly isPrototype = true; readonly isPrototype = true;
readonly meta: ComponentMeta; readonly meta: ComponentMeta;
readonly options: OldPrototypeConfig | ComponentMetadata; readonly options: OldPrototypeConfig | ComponentMetadata;
view: ComponentType;
// componentName: string;
get componentName() {
return this.getId();
}
get packageName() { get packageName() {
return this.meta.npm?.package; return this.meta.npm?.package;
} }
@ -322,6 +327,7 @@ class Prototype {
} }
setView(view: ComponentType<any>) { setView(view: ComponentType<any>) {
this.view = view;
const metadata = this.meta.getMetadata(); const metadata = this.meta.getMetadata();
if (!metadata.experimental) { if (!metadata.experimental) {
metadata.experimental = { metadata.experimental = {

View File

@ -1,8 +1,9 @@
import { ReactElement, ComponentType } from 'react'; import { ReactElement, ComponentType } from 'react';
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
import { registerSetter, RegisteredSetter, getSetter } from '@ali/lowcode-editor-core'; import { registerSetter, RegisteredSetter, getSetter } from '@ali/lowcode-editor-core';
import Bundle from './bundle'; import lg from '@ali/vu-logger';
import { CustomView } from '@ali/lowcode-types'; import { CustomView } from '@ali/lowcode-types';
import Bundle from './bundle';
import Prototype from './prototype'; import Prototype from './prototype';
export class Trunk { export class Trunk {