Skip to content

Commit

Permalink
fix(render): 修复多次不同渲染bug
Browse files Browse the repository at this point in the history
  • Loading branch information
guangwei.du committed Jan 22, 2019
1 parent 33b4e28 commit 811cef7
Show file tree
Hide file tree
Showing 6 changed files with 275 additions and 265 deletions.
9 changes: 6 additions & 3 deletions miniprogram_dist/poster/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ Component({
}
this.listener[event] = fun;
},
downloadResource() {
downloadResource(reset) {
return new Promise((resolve, reject) => {
if (reset) {
this.downloadStatus = null;
}
const poster = this.selectComponent('#poster');
if (this.downloadStatus && this.downloadStatus !== 'fail') {
if (this.downloadStatus === 'success') {
Expand All @@ -58,9 +61,9 @@ Component({
}
})
},
onCreate() {
onCreate(reset = false) {
!this.data.hideLoading && wx.showLoading({ mask: true, title: '生成中' });
return this.downloadResource().then(() => {
return this.downloadResource(typeof reset === 'boolean' && reset).then(() => {
!this.data.hideLoading && wx.hideLoading();
const poster = this.selectComponent('#poster');
poster.create(this.data.config);
Expand Down
4 changes: 2 additions & 2 deletions miniprogram_dist/poster/poster.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ function Poster(options = {}) {
return poster;
};

Poster.create = () => {
Poster.create = (reset = false) => {
const poster = Poster();
if (!poster) {
console.error('请设置组件的id="poster"!!!');
} else {
return Poster().onCreate();
return Poster().onCreate(reset);
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wxa-plugin-canvas",
"version": "1.1.8",
"version": "1.1.9",
"description": "小程序海报组件",
"main": "index.js",
"scripts": {
Expand Down
Loading

0 comments on commit 811cef7

Please sign in to comment.