index.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // components/My_SupplyAndDemandItemBox/index.js
  2. Component({
  3. options: {
  4. addGlobalClass: true,
  5. multipleSlots: true
  6. },
  7. /**
  8. * 组件的属性列表
  9. */
  10. properties: {
  11. title: {
  12. type: String,
  13. value: "标题"
  14. },
  15. time: {
  16. type: String
  17. },
  18. imageList: {
  19. type: Array,
  20. value: []
  21. },
  22. stopOnShow: {
  23. type: Function
  24. },
  25. },
  26. /**
  27. * 组件的初始数据
  28. */
  29. data: {
  30. urls: [],
  31. },
  32. /**
  33. * 组件的方法列表
  34. */
  35. methods: {
  36. /* 预览图片 */
  37. previewImage(e) {
  38. let imageList = this.data.imageList,
  39. urls = [];
  40. for (let i = 0; i < imageList.length; i++) {
  41. urls.push(imageList[i].fobsurl)
  42. }
  43. const {
  44. index
  45. } = e.currentTarget.dataset
  46. wx.previewImage({
  47. urls: urls,
  48. current: index
  49. })
  50. setTimeout(() => {
  51. this.triggerEvent('stopOnShow');
  52. }, 100)
  53. }
  54. }
  55. })