index.js 874 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { VantComponent } from '../common/component';
  2. import { addUnit } from '../common/utils';
  3. VantComponent({
  4. props: {
  5. dot: Boolean,
  6. info: null,
  7. size: {
  8. type: null,
  9. observer: 'setSizeWithUnit'
  10. },
  11. color: String,
  12. customStyle: String,
  13. classPrefix: {
  14. type: String,
  15. value: 'van-icon'
  16. },
  17. name: {
  18. type: String,
  19. observer(val) {
  20. this.setData({
  21. isImageName: val.indexOf('/') !== -1
  22. });
  23. }
  24. }
  25. },
  26. data: {
  27. sizeWithUnit: null,
  28. },
  29. methods: {
  30. onClick() {
  31. this.$emit('click');
  32. },
  33. setSizeWithUnit(size) {
  34. this.setData({
  35. sizeWithUnit: addUnit(size)
  36. });
  37. }
  38. }
  39. });