index.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <uni-shadow-root class="weapp-lib-index-anchor-index"><view class="van-index-anchor-wrapper" :style="wrapperStyle">
  3. <view :class="'van-index-anchor '+(active ? 'van-index-anchor--active van-hairline--bottom' : '')" :style="anchorStyle">
  4. <slot v-if="useSlot"></slot>
  5. <block v-else>
  6. <text>{{ index }}</text>
  7. </block>
  8. </view>
  9. </view></uni-shadow-root>
  10. </template>
  11. <script>
  12. global['__wxRoute'] = 'weapp/lib/index-anchor/index'
  13. "use strict";
  14. Object.defineProperty(exports, "__esModule", { value: true });
  15. var utils_1 = require("../common/utils");
  16. var component_1 = require("../common/component");
  17. var relation_1 = require("../common/relation");
  18. (0, component_1.VantComponent)({
  19. relation: (0, relation_1.useParent)('index-bar'),
  20. props: {
  21. useSlot: Boolean,
  22. index: null,
  23. },
  24. data: {
  25. active: false,
  26. wrapperStyle: '',
  27. anchorStyle: '',
  28. },
  29. methods: {
  30. scrollIntoView: function (scrollTop) {
  31. var _this = this;
  32. (0, utils_1.getRect)(this, '.van-index-anchor-wrapper').then(function (rect) {
  33. wx.pageScrollTo({
  34. duration: 0,
  35. scrollTop: scrollTop + rect.top - _this.parent.data.stickyOffsetTop,
  36. });
  37. });
  38. },
  39. },
  40. });
  41. export default global['__wxComponents']['weapp/lib/index-anchor/index']
  42. </script>
  43. <style platform="mp-weixin">
  44. @import '../common/index.css';.van-index-anchor{background-color:var(--index-anchor-background-color,transparent);color:var(--index-anchor-text-color,#323233);font-size:var(--index-anchor-font-size,14px);font-weight:var(--index-anchor-font-weight,500);line-height:var(--index-anchor-line-height,32px);padding:var(--index-anchor-padding,0 16px)}.van-index-anchor--active{background-color:var(--index-anchor-active-background-color,#fff);color:var(--index-anchor-active-text-color,#07c160);left:0;right:0}
  45. </style>