index.js 1.4 KB

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