Skip to content

Commit

Permalink
fix: fix demo error
Browse files Browse the repository at this point in the history
  • Loading branch information
pubuzhixing8 committed Jun 25, 2024
1 parent fa6bcde commit b3c3d7a
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/app/editor/image/image.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, HostListener, Input, OnInit } from '@angular/core';
import { ImageBaseComponent } from '@plait/common';
import { CommonImageItem, ImageBaseComponent } from '@plait/common';

@Component({
selector: 'app-plait-image',
Expand All @@ -10,6 +10,17 @@ import { ImageBaseComponent } from '@plait/common';
standalone: true
})
export class PlaitImageComponent extends ImageBaseComponent implements OnInit {
_imageItem!: CommonImageItem;

set imageItem(value: CommonImageItem) {
this._imageItem = value;
this.cdr.markForCheck();
}

get imageItem() {
return this._imageItem;
}

constructor(protected elementRef: ElementRef<HTMLElement>, public cdr: ChangeDetectorRef) {
super();
}
Expand All @@ -19,12 +30,5 @@ export class PlaitImageComponent extends ImageBaseComponent implements OnInit {
}

ngOnInit(): void {
super.initialize();
}

afterImageItemChange() {
if (this.initialized) {
this.cdr.detectChanges();
}
}
}

0 comments on commit b3c3d7a

Please sign in to comment.