-
zhangwei
2025-03-05 16213c0f85aa3ac8317797bf4a05fd12940e16d3
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和bottom,对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() {