0
0

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 3 years have passed since last update.

[Vue.js]v-bind

Posted at

v-bindでGoogleへのlinkつくってみる

```javascript js data:{ //htmlに挿入するurlをdataの中に入れておく url:'https://www.google.com/?hl=ja' ```
//これでGoogleへのリンクが貼られる
<a v-bind:href = "url">google</a>

Googleへのリンク以外にもクラスやidなどまとめて表示させたい場合

js
data:
//まとめてgoogleオブジェクトをつくる
    google:{
        href:'https://www.google.com/?hl=ja',
        id:12,
        class:'goo'
    }
html
<a v-bind = 'google'>google</a>

href="https://www.google.com/?hl=ja" id="12" class="goo">google

検証画面で見ると上のようになっている(aタグが本当はある)

ちゃんとhref属性とidとclassがまとめてaタグの中に入ってます

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?