index.js 788 B

123456789101112131415161718192021222324252627282930313233
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var component_1 = require('../common/component');
  4. component_1.VantComponent({
  5. relation: {
  6. name: 'index-bar',
  7. type: 'ancestor',
  8. current: 'index-anchor',
  9. },
  10. props: {
  11. useSlot: Boolean,
  12. index: null,
  13. },
  14. data: {
  15. active: false,
  16. wrapperStyle: '',
  17. anchorStyle: '',
  18. },
  19. methods: {
  20. scrollIntoView: function (scrollTop) {
  21. var _this = this;
  22. this.getBoundingClientRect().then(function (rect) {
  23. wx.pageScrollTo({
  24. duration: 0,
  25. scrollTop: scrollTop + rect.top - _this.parent.data.stickyOffsetTop,
  26. });
  27. });
  28. },
  29. getBoundingClientRect: function () {
  30. return this.getRect('.van-index-anchor-wrapper');
  31. },
  32. },
  33. });