7
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Vue.js] vue.jsでアンカーリンクを作成する

Posted at

やりたいこと

vue.jsでアンカーリンク(ページ内リンク)の実現

手順

###[その1] vue-smooth-scrollのインストール

cd *** // プロジェクトのディレクトリに移動 
npm i -D vue-smooth-scroll

###[その2] main.jsファイルにプラグインの使用を宣言

import vueSmoothScroll from 'vue-smooth-scroll'
Vue.use(vueSmoothScroll);

###[その3] 挿入

<a href="#section1" v-smooth-scroll="{ duration: 1000, offset: -50 }">セクション1</a>

<div id="section1">
  <!-- セクション1のコンテンツ -->
</div>
7
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?