index.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 utils_1 = require("../common/utils");
  6. (0, component_1.VantComponent)({
  7. props: {
  8. inactive: Boolean,
  9. percentage: {
  10. type: Number,
  11. observer: 'setLeft',
  12. },
  13. pivotText: String,
  14. pivotColor: String,
  15. trackColor: String,
  16. showPivot: {
  17. type: Boolean,
  18. value: true,
  19. },
  20. color: {
  21. type: String,
  22. value: color_1.BLUE,
  23. },
  24. textColor: {
  25. type: String,
  26. value: '#fff',
  27. },
  28. strokeWidth: {
  29. type: null,
  30. value: 4,
  31. },
  32. },
  33. data: {
  34. right: 0,
  35. },
  36. mounted: function () {
  37. this.setLeft();
  38. },
  39. methods: {
  40. setLeft: function () {
  41. var _this = this;
  42. Promise.all([
  43. (0, utils_1.getRect)(this, '.van-progress'),
  44. (0, utils_1.getRect)(this, '.van-progress__pivot'),
  45. ]).then(function (_a) {
  46. var portion = _a[0], pivot = _a[1];
  47. if (portion && pivot) {
  48. _this.setData({
  49. right: (pivot.width * (_this.data.percentage - 100)) / 100,
  50. });
  51. }
  52. });
  53. },
  54. },
  55. });