feat:modular add provider

This commit is contained in:
pengfei.zhou
2021-05-14 13:14:54 +08:00
committed by osborn
parent eb7fc6c137
commit 67f3f354af
11 changed files with 79 additions and 6 deletions

View File

@@ -76,6 +76,7 @@ export declare abstract class View implements Modeling {
[index: string]: Model;
};
nativeViewModel: NativeViewModel;
viewType(): string;
onPropertyChanged(propKey: string, oldV: Model, newV: Model): void;
clean(): void;
isDirty(): boolean;

View File

@@ -30,7 +30,7 @@ export class View {
this.__dirty_props__ = {};
this.nativeViewModel = {
id: this.viewId,
type: this.constructor.name,
type: this.viewType(),
props: this.__dirty_props__,
};
return new Proxy(this, {
@@ -108,6 +108,9 @@ export class View {
get dirtyProps() {
return this.__dirty_props__;
}
viewType() {
return this.constructor.name;
}
onPropertyChanged(propKey, oldV, newV) {
if (newV instanceof Function) {
newV = this.callback2Id(newV);