📜  页面链接或锚点上的 vue - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:15.861000             🧑  作者: Mango

代码示例2
//P.S. the code is written for Vue 2.
//You will have to adjust it to Vue 1.

//Your view:
// Porto, Portugal
// ...
// 
//Your code: methods: { scrollMeTo(refName) { var element = this.$refs[refName]; var top = element.offsetTop; window.scrollTo(0, top); } }