basic.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true
  4. });
  5. exports.basic = void 0;
  6. exports.basic = {
  7. methods: {
  8. $emit: function () {
  9. var args = [];
  10. for (var _i = 0; _i < arguments.length; _i++) {
  11. args[_i] = arguments[_i];
  12. }
  13. this.triggerEvent.apply(this, args);
  14. },
  15. set: function (data, callback) {
  16. this.setData(data, callback);
  17. return new Promise(function (resolve) {
  18. return this.$nextTick(resolve);
  19. });
  20. },
  21. getRect: function (selector, all) {
  22. var that = this;
  23. return new Promise(function (resolve) {
  24. uni.createSelectorQuery()
  25. .in(that)
  26. [all ? 'selectAll' : 'select'](selector)
  27. .boundingClientRect(function (rect) {
  28. if (all && Array.isArray(rect) && rect.length) {
  29. resolve(rect);
  30. }
  31. if (!all && rect) {
  32. resolve(rect);
  33. }
  34. })
  35. .exec();
  36. });
  37. }
  38. }
  39. };