index.js 613 Bytes
Newer Older
程默 committed
1
import { getRect } from '../common/utils';
李嘉林 committed
2 3
import { VantComponent } from '../common/component';
VantComponent({
程默 committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
  relation: {
    name: 'index-bar',
    type: 'ancestor',
    current: 'index-anchor',
  },
  props: {
    useSlot: Boolean,
    index: null,
  },
  data: {
    active: false,
    wrapperStyle: '',
    anchorStyle: '',
  },
  methods: {
    scrollIntoView(scrollTop) {
      getRect(this, '.van-index-anchor-wrapper').then((rect) => {
        wx.pageScrollTo({
          duration: 0,
          scrollTop: scrollTop + rect.top - this.parent.data.stickyOffsetTop,
        });
      });
李嘉林 committed
26
    },
程默 committed
27
  },
李嘉林 committed
28
});