index.js 888 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { VantComponent } from '../common/component';
  2. import { addUnit } from '../common/utils';
  3. VantComponent({
  4. props: {
  5. size: {
  6. type: String,
  7. observer: 'setSizeWithUnit'
  8. },
  9. type: {
  10. type: String,
  11. value: 'circular'
  12. },
  13. color: {
  14. type: String,
  15. value: '#c9c9c9'
  16. },
  17. textSize: {
  18. type: String,
  19. observer: 'setTextSizeWithUnit'
  20. },
  21. vertical: Boolean
  22. },
  23. data: {
  24. sizeWithUnit: '30px',
  25. textSizeWithUnit: '14px'
  26. },
  27. methods: {
  28. setSizeWithUnit(size) {
  29. this.setData({
  30. sizeWithUnit: addUnit(size)
  31. });
  32. },
  33. setTextSizeWithUnit(size) {
  34. this.set({
  35. textSizeWithUnit: addUnit(size)
  36. });
  37. }
  38. }
  39. });