index.js 694B

1234567891011121314151617181920212223242526
  1. import { getRect } from '../common/utils';
  2. import { VantComponent } from '../common/component';
  3. import { useParent } from '../common/relation';
  4. VantComponent({
  5. relation: useParent('index-bar'),
  6. props: {
  7. useSlot: Boolean,
  8. index: null,
  9. },
  10. data: {
  11. active: false,
  12. wrapperStyle: '',
  13. anchorStyle: '',
  14. },
  15. methods: {
  16. scrollIntoView(scrollTop) {
  17. getRect(this, '.van-index-anchor-wrapper').then((rect) => {
  18. wx.pageScrollTo({
  19. duration: 0,
  20. scrollTop: scrollTop + rect.top - this.parent.data.stickyOffsetTop,
  21. });
  22. });
  23. },
  24. },
  25. });