index.js 1.5 KB

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