basic.js 824 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.basic = Behavior({
  4. methods: {
  5. $emit: function () {
  6. this.triggerEvent.apply(this, arguments);
  7. },
  8. getRect: function (selector, all) {
  9. var _this = this;
  10. return new Promise(function (resolve) {
  11. wx.createSelectorQuery()
  12. .in(_this)[all ? 'selectAll' : 'select'](selector)
  13. .boundingClientRect(function (rect) {
  14. if (all && Array.isArray(rect) && rect.length) {
  15. resolve(rect);
  16. }
  17. if (!all && rect) {
  18. resolve(rect);
  19. }
  20. })
  21. .exec();
  22. });
  23. }
  24. }
  25. });