From 299482d7f68ee5de04ebebbd4ea6460c06104f75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?LAPTOP-D7TKRI82=5C=E9=82=93?= <52643018@qq.com> Date: Wed, 25 Aug 2021 14:24:26 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BC=98=E5=8C=96]=20=E4=BB=B7=E6=A0=BC?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=A0=B7=E5=BC=8F=20[=E4=BC=98=E5=8C=96]=20?= =?UTF-8?q?=E5=85=A8=E5=B1=80$msg=E6=96=B9=E6=B3=95=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0promise=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/mixin.js | 24 +++++++++++++++++------- components/lf-price/lf-price.vue | 2 +- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/common/mixin.js b/common/mixin.js index e48c468..167e151 100644 --- a/common/mixin.js +++ b/common/mixin.js @@ -57,13 +57,23 @@ export default{ } }, $msg(title = '', param = {}) { - if(!title) return; - uni.showToast({ - title, - duration: param.duration || 1500, - mask: param.mask || true, // 默认应该加mask 禁止提示时操作 - icon: param.icon || 'none' - }); + return new Promise((resolve, reject) => { + if(!title){ + reject(); + return; + } + uni.showToast({ + title, + duration: param.duration || 1500, + mask: param.mask || true, // 默认应该加mask 禁止提示时操作 + icon: param.icon || 'none', + complete: result => { + setTimeout(() => { + resolve(); + }, param.duration || 1500); + } + }); + }) }, $url(url, options = {}){ this.$u.throttle(() => { diff --git a/components/lf-price/lf-price.vue b/components/lf-price/lf-price.vue index 49ca23a..d86c445 100644 --- a/components/lf-price/lf-price.vue +++ b/components/lf-price/lf-price.vue @@ -1,5 +1,5 @@