index.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. webp: {
  31. type: Boolean,
  32. value: false,
  33. },
  34. showError: {
  35. type: Boolean,
  36. value: true,
  37. },
  38. showLoading: {
  39. type: Boolean,
  40. value: true,
  41. },
  42. },
  43. data: {
  44. error: false,
  45. loading: true,
  46. viewStyle: '',
  47. },
  48. methods: {
  49. onLoad: function (event) {
  50. this.setData({
  51. loading: false,
  52. });
  53. this.$emit('load', event.detail);
  54. },
  55. onError: function (event) {
  56. this.setData({
  57. loading: false,
  58. error: true,
  59. });
  60. this.$emit('error', event.detail);
  61. },
  62. onClick: function (event) {
  63. this.$emit('click', event.detail);
  64. },
  65. },
  66. });