Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
115 views
in Technique[技术] by (71.8m points)

vue 中不存在scrollTo

不是nextTick原因,是确实refs对象中确实没有,scrollTo是Jq中的?必须加Jq才能使用?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

ref是可以scrollTop的,可能你的滚动元素找错了:

<div ref="appMain"></div>

this.$nextTick(() => {
    this.$refs.appMain.scrollTo(0, 0)
})

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...