index.js 1.2 KB

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