Merge pull request #4007 from lison16/anchor
增加scroll-offset属性,定义滚动结束后距离容器顶部的距离
This commit is contained in:
commit
c270c09a81
2 changed files with 6 additions and 2 deletions
|
@ -53,6 +53,10 @@ export default {
|
|||
showInkInFixed: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
scrollOffset: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -92,7 +96,7 @@ export default {
|
|||
handleScrollTo () {
|
||||
const anchor = document.getElementById(this.currentId);
|
||||
if (!anchor) return;
|
||||
const offsetTop = anchor.offsetTop - this.wrapperTop;
|
||||
const offsetTop = anchor.offsetTop - this.wrapperTop - this.scrollOffset;
|
||||
this.animating = true;
|
||||
scrollTop(this.scrollContainer, this.scrollElement.scrollTop, offsetTop, 600, () => {
|
||||
this.animating = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue