| | |
| | | <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'; |
| | | /** |
| | |
| | | }, |
| | | // 内容盒子的样式 |
| | | contentStyle() { |
| | | const windowHeight = sys().windowHeight, style = {} |
| | | const windowHeight = getWindowInfo().windowHeight, style = {} |
| | | let value = 0 |
| | | // 根据top和bottom,对Y轴进行窗体高度的百分比偏移 |
| | | if(this.tmpConfig.position === 'top') { |
| | |
| | | // 清除定时器 |
| | | 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() { |