index.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var component_1 = require("../common/component");
  4. var button_1 = require("../mixins/button");
  5. (0, component_1.VantComponent)({
  6. mixins: [button_1.button],
  7. classes: ['custom-class', 'loading-class', 'error-class', 'image-class'],
  8. props: {
  9. src: {
  10. type: String,
  11. observer: function () {
  12. this.setData({
  13. error: false,
  14. loading: true,
  15. });
  16. },
  17. },
  18. round: Boolean,
  19. width: null,
  20. height: null,
  21. radius: null,
  22. lazyLoad: Boolean,
  23. useErrorSlot: Boolean,
  24. useLoadingSlot: Boolean,
  25. showMenuByLongpress: Boolean,
  26. fit: {
  27. type: String,
  28. value: 'fill',
  29. },
  30. showError: {
  31. type: Boolean,
  32. value: true,
  33. },
  34. showLoading: {
  35. type: Boolean,
  36. value: true,
  37. },
  38. },
  39. data: {
  40. error: false,
  41. loading: true,
  42. viewStyle: '',
  43. },
  44. methods: {
  45. onLoad: function (event) {
  46. this.setData({
  47. loading: false,
  48. });
  49. this.$emit('load', event.detail);
  50. },
  51. onError: function (event) {
  52. this.setData({
  53. loading: false,
  54. error: true,
  55. });
  56. this.$emit('error', event.detail);
  57. },
  58. onClick: function (event) {
  59. this.$emit('click', event.detail);
  60. },
  61. },
  62. });