From 16213c0f85aa3ac8317797bf4a05fd12940e16d3 Mon Sep 17 00:00:00 2001 From: zhangwei <1504152376@qq.com> Date: 星期三, 05 三月 2025 17:29:42 +0800 Subject: [PATCH] - --- src/uni_modules/uview-plus/components/u-toast/u-toast.vue | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/uni_modules/uview-plus/components/u-toast/u-toast.vue b/src/uni_modules/uview-plus/components/u-toast/u-toast.vue index c2cd33d..dd1b942 100644 --- a/src/uni_modules/uview-plus/components/u-toast/u-toast.vue +++ b/src/uni_modules/uview-plus/components/u-toast/u-toast.vue @@ -42,7 +42,7 @@ <script> import { mpMixin } from '../../libs/mixin/mpMixin'; import { mixin } from '../../libs/mixin/mixin'; - import { os, sys, deepMerge, type2icon } from '../../libs/function/index'; + import { os, getWindowInfo, deepMerge, type2icon } from '../../libs/function/index'; import color from '../../libs/config/color'; import { hexToRgb } from '../../libs/function/colorGradient'; /** @@ -136,7 +136,7 @@ }, // 鍐呭鐩掑瓙鐨勬牱寮� contentStyle() { - const windowHeight = sys().windowHeight, style = {} + const windowHeight = getWindowInfo().windowHeight, style = {} let value = 0 // 鏍规嵁top鍜宐ottom锛屽Y杞磋繘琛岀獥浣撻珮搴︾殑鐧惧垎姣斿亸绉� if(this.tmpConfig.position === 'top') { @@ -165,12 +165,15 @@ // 娓呴櫎瀹氭椂鍣� this.clearTimer() this.isShow = true - this.timer = setTimeout(() => { - // 鍊掕鏃剁粨鏉燂紝娓呴櫎瀹氭椂鍣紝闅愯棌toast缁勪欢 - this.clearTimer() - // 鍒ゆ柇鏄惁瀛樺湪callback鏂规硶锛屽鏋滃瓨鍦ㄥ氨鎵ц - typeof(this.tmpConfig.complete) === 'function' && this.tmpConfig.complete() - }, this.tmpConfig.duration) + // -1鏃朵笉鑷姩鍏抽棴 + if (this.tmpConfig.duration !== -1) { + this.timer = setTimeout(() => { + // 鍊掕鏃剁粨鏉燂紝娓呴櫎瀹氭椂鍣紝闅愯棌toast缁勪欢 + this.clearTimer() + // 鍒ゆ柇鏄惁瀛樺湪callback鏂规硶锛屽鏋滃瓨鍦ㄥ氨鎵ц + typeof(this.tmpConfig.complete) === 'function' && this.tmpConfig.complete() + }, this.tmpConfig.duration) + } }, // 闅愯棌toast缁勪欢锛岀敱鐖剁粍浠堕�氳繃this.$refs.xxx.hide()褰㈠紡璋冪敤 hide() { -- Gitblit v1.9.1