From 38714e0d5e80c2a8949f89111680cf2ec10a5a2a Mon Sep 17 00:00:00 2001 From: J Date: Sun, 1 Dec 2019 22:07:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20hideLoading=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/weapp/component/taro-plugin-canvas/index.jsx | 6 ++++-- package.json | 2 +- src/component/taro-plugin-canvas/index.tsx | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dist/weapp/component/taro-plugin-canvas/index.jsx b/dist/weapp/component/taro-plugin-canvas/index.jsx index 21594ca..6573b44 100644 --- a/dist/weapp/component/taro-plugin-canvas/index.jsx +++ b/dist/weapp/component/taro-plugin-canvas/index.jsx @@ -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) { diff --git a/package.json b/package.json index db90ebe..40ac1b4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "taro-plugin-canvas", - "version": "1.0.8-beta.2", + "version": "1.0.9", "description": "基于 Taro 框架的微信小程序 canvas 绘图组件,封装了常用的操作,通过配置的方式生成分享图片", "keywords": [ "taro", diff --git a/src/component/taro-plugin-canvas/index.tsx b/src/component/taro-plugin-canvas/index.tsx index 055fe75..aa75cf7 100644 --- a/src/component/taro-plugin-canvas/index.tsx +++ b/src/component/taro-plugin-canvas/index.tsx @@ -170,13 +170,15 @@ export default class CanvasDrawer extends Component { 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) {