index.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. lifetimes: {
  27. ready: function () {
  28. // 在组件实例进入页面节点树时执行
  29. },
  30. detached: function () {
  31. // 在组件实例被从页面节点树移除时执行
  32. },
  33. },
  34. /**
  35. * 组件的初始数据
  36. */
  37. data: {
  38. urls: [],
  39. },
  40. /**
  41. * 组件的方法列表
  42. */
  43. methods: {
  44. /* 预览图片 */
  45. previewImage(e) {
  46. let imageList = this.data.imageList,
  47. urls = [];
  48. for (let i = 0; i < imageList.length; i++) {
  49. urls.push(imageList[i].fobsurl)
  50. }
  51. const {
  52. index
  53. } = e.currentTarget.dataset
  54. wx.previewImage({
  55. urls: urls,
  56. current: index
  57. })
  58. setTimeout(() => {
  59. this.triggerEvent('stopOnShow');
  60. }, 100)
  61. }
  62. }
  63. })