index.js 1.4 KB

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