index.js 893 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //Component Object
  2. Component({
  3. properties: {
  4. commentsList: {
  5. type: Array,
  6. value: [],
  7. observer: function () {}
  8. },
  9. },
  10. data: {
  11. },
  12. methods: {
  13. // 预览图片
  14. previewImg: function (e) {
  15. //获取当前图片的下标
  16. var index = e.currentTarget.dataset.index;
  17. var active = e.currentTarget.dataset.active;
  18. //所有图片
  19. var imgs = this.properties.commentsList[active].imgs;
  20. wx.previewImage({
  21. //当前显示图片
  22. current: imgs[index],
  23. //所有图片
  24. urls: imgs
  25. })
  26. },
  27. },
  28. created: function () {
  29. },
  30. attached: function () {
  31. },
  32. ready: function () {
  33. },
  34. moved: function () {
  35. },
  36. detached: function () {
  37. },
  38. });