feat(Sticky): offset-top can be string

This commit is contained in:
陈嘉涵
2020-01-30 10:36:47 +08:00
parent 3cc99b3abe
commit 3c2afab6d8
3 changed files with 7 additions and 6 deletions
+3 -2
View File
@@ -20,7 +20,7 @@ export default createComponent({
zIndex: [Number, String],
container: null,
offsetTop: {
type: Number,
type: [Number, String],
default: 0,
},
},
@@ -61,7 +61,8 @@ export default createComponent({
onScroll() {
this.height = this.$el.offsetHeight;
const { container, offsetTop } = this;
const { container } = this;
const offsetTop = +this.offsetTop;
const scrollTop = getScrollTop(window);
const topToPageTop = getElementTop(this.$el);