poster.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. Component({
  2. properties: {
  3. obj: {
  4. type: Object,
  5. value: {}
  6. },
  7. barcodeImgUrl: {
  8. type: String,
  9. value: 'https://discuz.hoolihome.com/defaults/barcode2.jpg'
  10. }
  11. },
  12. data: {
  13. dataArr: [],
  14. logoImgUrl: 'https://static.hoolihome.com/weapp/hoolihome/slogan.png?v=1'
  15. },
  16. methods: {
  17. getElementInfo: function () {
  18. const query = wx.createSelectorQuery().in(this); //fields
  19. query.selectAll('.canvas-part').fields({
  20. dataset: true,
  21. rect: true,
  22. id: true,
  23. size: true,
  24. computedStyle: ['color', 'backgroundColor', 'fontSize', 'fontWeight', 'borderRadius'],
  25. context: true,
  26. }, function (res) {
  27. let pages = getCurrentPages();
  28. let curPage = pages[pages.length - 1];
  29. if (res && curPage && curPage.posterCallack) {
  30. curPage.posterCallack(res);
  31. } else {
  32. curPage.posterCallack(null);
  33. }
  34. }).exec()
  35. },
  36. photoLoaded: function (e) {
  37. this.getElementInfo();
  38. }
  39. },
  40. lifetimes: {
  41. ready: function () {
  42. // this.getElementInfo();
  43. }
  44. }
  45. })