Home > Web Front-end > JS Tutorial > How to implement simulated anchor points in vue2.0

How to implement simulated anchor points in vue2.0

php中世界最好的语言
Release: 2018-04-11 14:07:37
Original
1883 people have browsed it

This time I will bring you how to implement simulation in vue2.0anchor point, what are the notes for implementing simulation anchor point in vue2.0, the following is a practical case , let’s take a look.

Solution:

<a href="javascript:void(0)" rel="external nofollow" @click="goAnchor(&#39;#anchor&#39;)"> 灰啊灰啊我的骄傲放纵</a>
Copy after login
rrree

17. 9. 20 Update: The above has a BUG in FireFox, the fix is ​​as follows:

methods: {
 goAnchor(selector) {
  var anchor = this.$el.querySelector(selector)
  document.body.scrollTop = anchor.offsetTop
 }
}
Copy after login

I believe you have mastered it after reading the case in this article Method, for more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

How to use sass configuration in vue project

How to use the on-change attribute in IView

The above is the detailed content of How to implement simulated anchor points in vue2.0. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template