From eb7366f400867d3f401fe60f06d848d6d1448457 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期一, 17 十月 2022 17:41:56 +0800
Subject: [PATCH] 2022.10.17
---
base/behaviors/b_loadingToast.js | 15 ++++-----------
1 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/base/behaviors/b_loadingToast.js b/base/behaviors/b_loadingToast.js
index 25e45ca..13e60b0 100644
--- a/base/behaviors/b_loadingToast.js
+++ b/base/behaviors/b_loadingToast.js
@@ -1,5 +1,3 @@
-const { clearTimeout } = require("timers");
-
/**
* 鏁版嵁鍔犺浇寮圭獥
* 鏍规嵁鍔犺浇鐘舵�侊紝灞曠ず瀵瑰簲鐨勫脊绐�
@@ -8,20 +6,16 @@
module.exports = Behavior({
data: {
loadingText: '鍔犺浇涓�',
- loadCompleteText: '鍔犺浇瀹屾垚'
+ loadCompleteText: '鍔犺浇瀹屾垚',
+ timeoutText: '鍔犺浇瓒呮椂'
},
- timeoutId: '',
methods: {
// 鍔犺浇寮�濮媡oast
loadStart() {
- clearTimeout(this.timeoutId)
wx.showLoading({
title: this.data.loadingText,
mask: true,
})
- this.timeoutId = setTimeout(() => {
- wx.hideLoading()
- }, 20000);
},
// 鍔犺浇涓璽oast
loading() {
@@ -29,13 +23,12 @@
},
// 鍔犺浇瀹屾垚toast
loadComplete() {
- clearTimeout(this.timeoutId)
wx.hideLoading({
success: (res) => {
wx.showToast({
- title: this.data.loadCompleteText,
+ title: this.data.timeout ? this.data.timeoutText : this.data.loadCompleteText,
duration: 1000,
- icon: 'success',
+ icon: this.data.timeout ? 'error' : 'success',
mask: true,
})
},
--
Gitblit v1.9.3