index.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var component_1 = require("../common/component");
  4. var color_1 = require("../common/color");
  5. var safe_area_1 = require("../mixins/safe-area");
  6. component_1.VantComponent({
  7. mixins: [safe_area_1.safeArea()],
  8. props: {
  9. text: String,
  10. color: {
  11. type: String,
  12. value: '#fff'
  13. },
  14. backgroundColor: {
  15. type: String,
  16. value: color_1.RED
  17. },
  18. duration: {
  19. type: Number,
  20. value: 3000
  21. },
  22. zIndex: {
  23. type: Number,
  24. value: 110
  25. }
  26. },
  27. methods: {
  28. show: function () {
  29. var _this = this;
  30. var duration = this.data.duration;
  31. clearTimeout(this.timer);
  32. this.set({
  33. show: true
  34. });
  35. if (duration > 0 && duration !== Infinity) {
  36. this.timer = setTimeout(function () {
  37. _this.hide();
  38. }, duration);
  39. }
  40. },
  41. hide: function () {
  42. clearTimeout(this.timer);
  43. this.set({
  44. show: false
  45. });
  46. }
  47. }
  48. });