VUE项目里写锚链接
HTML
<a href="javascript:void(0)" @click="goAnchor('#anchor')"> 灰啊灰啊我的骄傲放纵</a>
<div class="footer" id="anchor">到我这里来</div>
JS
goAnchor(selector) {
var anchor = this.$el.querySelector(selector)
document.body.scrollTop = anchor.offsetTop
},
以上在FireFox有BUG,修复如下:
document.documentElement.scrollTop = anchor.offsetTop; // firefox
刷新页面功能最简单的方法
<a href="" > 刷新页面</a>