index.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. 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. utils_1.getRect(this, '.van-progress'),
  44. utils_1.getRect(this, '.van-progress__pivot'),
  45. ]).then(function (_a) {
  46. var portion = _a[0],
  47. pivot = _a[1];
  48. if (portion && pivot) {
  49. _this.setData({
  50. right: (pivot.width * (_this.data.percentage - 100)) / 100,
  51. });
  52. }
  53. });
  54. },
  55. },
  56. });