Commit b46887f3 authored by 范雪寒's avatar 范雪寒

fix: 表单页面上传完图片后预览页面不刷新问题

parent 21984688
...@@ -271,11 +271,14 @@ export class PreviewCanvas implements OnInit, OnDestroy { ...@@ -271,11 +271,14 @@ export class PreviewCanvas implements OnInit, OnDestroy {
return Promise.all(pr); return Promise.all(pr);
} }
refresh() { refresh(data) {
this.canvasWidth = this.wrap.nativeElement.clientWidth; this.canvasWidth = this.wrap.nativeElement.clientWidth;
this.canvasHeight = this.wrap.nativeElement.clientHeight; this.canvasHeight = this.wrap.nativeElement.clientHeight;
this.init(); this.game.initData({
this.game.refresh(); images: this.images,
data: this.data,
});
this.load();
} }
preload(url) { preload(url) {
......
...@@ -142,9 +142,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -142,9 +142,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
save() { save() {
(<any>window).courseware.setData(this.item, null, this.saveKey); (<any>window).courseware.setData(this.item, null, this.saveKey);
this.refresh(); this.refresh();
this.previewCanvas.refresh(); this.previewCanvas.refresh(this.item);
console.log(JSON.stringify(this.item));
} }
/** /**
......
...@@ -27,7 +27,8 @@ export class Game { ...@@ -27,7 +27,8 @@ export class Game {
} }
refresh() { refresh(data) {
this.initData(data);
this.removeChildren(); this.removeChildren();
this.initView(); this.initView();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment