Skip to content

Commit

Permalink
fix: hideLoading 问题
Browse files Browse the repository at this point in the history
  • Loading branch information
chuyun committed Dec 1, 2019
1 parent f9548f0 commit 38714e0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions dist/weapp/component/taro-plugin-canvas/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@ export default class CanvasDrawer extends Component {
};
this.onCreate = () => {
const { onCreateFail, config } = this.props;
Taro.showLoading({ mask: true, title: '生成中...' });
if (config['hide-loading'] === false) {
Taro.showLoading({ mask: true, title: '生成中...' });
}
return this.downloadResourceTransit()
.then(() => {
this.create(config);
})
.catch((err) => {
Taro.hideLoading();
config['hide-loading'] && Taro.hideLoading();
Taro.showToast({ icon: 'none', title: err.errMsg || '下载图片失败' });
console.error(err);
if (!onCreateFail) {
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": "taro-plugin-canvas",
"version": "1.0.8-beta.2",
"version": "1.0.9",
"description": "基于 Taro 框架的微信小程序 canvas 绘图组件,封装了常用的操作,通过配置的方式生成分享图片",
"keywords": [
"taro",
Expand Down
6 changes: 4 additions & 2 deletions src/component/taro-plugin-canvas/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,15 @@ export default class CanvasDrawer extends Component<ICanvasDrawerProps, ICanvasD

onCreate = () => {
const { onCreateFail, config } = this.props;
Taro.showLoading({ mask: true, title: '生成中...' });
if (config['hide-loading'] === false) {
Taro.showLoading({ mask: true, title: '生成中...' });
}
return this.downloadResourceTransit()
.then(() => {
this.create(config);
})
.catch((err) => {
Taro.hideLoading();
config['hide-loading'] && Taro.hideLoading();
Taro.showToast({ icon: 'none', title: err.errMsg || '下载图片失败' });
console.error(err);
if (!onCreateFail) {
Expand Down

1 comment on commit 38714e0

@chuyun
Copy link
Owner Author

@chuyun chuyun commented on 38714e0 Dec 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix #22

Please sign in to comment.