first
This commit is contained in:
1
node_modules/vant/es/index-anchor/index.css
generated
vendored
Normal file
1
node_modules/vant/es/index-anchor/index.css
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
.van-index-anchor{z-index:1;box-sizing:border-box;padding:0 16px;color:#323233;font-weight:500;font-size:14px;line-height:32px;background-color:transparent}.van-index-anchor--sticky{position:fixed;top:0;right:0;left:0;color:#ee0a24;background-color:#fff}
|
83
node_modules/vant/es/index-anchor/index.js
generated
vendored
Normal file
83
node_modules/vant/es/index-anchor/index.js
generated
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
import { createNamespace } from '../utils';
|
||||
import { ChildrenMixin } from '../mixins/relation';
|
||||
import { BORDER_BOTTOM } from '../utils/constant';
|
||||
import { getScrollTop, getRootScrollTop } from '../utils/dom/scroll';
|
||||
|
||||
var _createNamespace = createNamespace('index-anchor'),
|
||||
createComponent = _createNamespace[0],
|
||||
bem = _createNamespace[1];
|
||||
|
||||
export default createComponent({
|
||||
mixins: [ChildrenMixin('vanIndexBar', {
|
||||
indexKey: 'childrenIndex'
|
||||
})],
|
||||
props: {
|
||||
index: [Number, String]
|
||||
},
|
||||
data: function data() {
|
||||
return {
|
||||
top: 0,
|
||||
left: null,
|
||||
rect: {
|
||||
top: 0,
|
||||
height: 0
|
||||
},
|
||||
width: null,
|
||||
active: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
sticky: function sticky() {
|
||||
return this.active && this.parent.sticky;
|
||||
},
|
||||
anchorStyle: function anchorStyle() {
|
||||
if (this.sticky) {
|
||||
return {
|
||||
zIndex: "" + this.parent.zIndex,
|
||||
left: this.left ? this.left + "px" : null,
|
||||
width: this.width ? this.width + "px" : null,
|
||||
transform: "translate3d(0, " + this.top + "px, 0)",
|
||||
color: this.parent.highlightColor
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted: function mounted() {
|
||||
var rect = this.$el.getBoundingClientRect();
|
||||
this.rect.height = rect.height;
|
||||
},
|
||||
methods: {
|
||||
scrollIntoView: function scrollIntoView() {
|
||||
this.$el.scrollIntoView();
|
||||
},
|
||||
getRect: function getRect(scroller, scrollerRect) {
|
||||
var el = this.$el;
|
||||
var elRect = el.getBoundingClientRect();
|
||||
this.rect.height = elRect.height;
|
||||
|
||||
if (scroller === window || scroller === document.body) {
|
||||
this.rect.top = elRect.top + getRootScrollTop();
|
||||
} else {
|
||||
this.rect.top = elRect.top + getScrollTop(scroller) - scrollerRect.top;
|
||||
}
|
||||
|
||||
return this.rect;
|
||||
}
|
||||
},
|
||||
render: function render() {
|
||||
var _ref;
|
||||
|
||||
var h = arguments[0];
|
||||
var sticky = this.sticky;
|
||||
return h("div", {
|
||||
"style": {
|
||||
height: sticky ? this.rect.height + "px" : null
|
||||
}
|
||||
}, [h("div", {
|
||||
"style": this.anchorStyle,
|
||||
"class": [bem({
|
||||
sticky: sticky
|
||||
}), (_ref = {}, _ref[BORDER_BOTTOM] = sticky, _ref)]
|
||||
}, [this.slots('default') || this.index])]);
|
||||
}
|
||||
});
|
21
node_modules/vant/es/index-anchor/index.less
generated
vendored
Normal file
21
node_modules/vant/es/index-anchor/index.less
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
@import '../style/var';
|
||||
|
||||
.van-index-anchor {
|
||||
z-index: @index-anchor-z-index;
|
||||
box-sizing: border-box;
|
||||
padding: @index-anchor-padding;
|
||||
color: @index-anchor-text-color;
|
||||
font-weight: @index-anchor-font-weight;
|
||||
font-size: @index-anchor-font-size;
|
||||
line-height: @index-anchor-line-height;
|
||||
background-color: @index-anchor-background-color;
|
||||
|
||||
&--sticky {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
color: @index-anchor-sticky-text-color;
|
||||
background-color: @index-anchor-sticky-background-color;
|
||||
}
|
||||
}
|
2
node_modules/vant/es/index-anchor/style/index.js
generated
vendored
Normal file
2
node_modules/vant/es/index-anchor/style/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import '../../style/base.css';
|
||||
import '../index.css';
|
2
node_modules/vant/es/index-anchor/style/less.js
generated
vendored
Normal file
2
node_modules/vant/es/index-anchor/style/less.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import '../../style/base.less';
|
||||
import '../index.less';
|
Reference in New Issue
Block a user