LoginSignup
7
8

More than 5 years have passed since last update.

Vue.js + jQueryプラグイン

Last updated at Posted at 2014-12-23

業務でIE9〜の案件が降ってきたので、vue.jsを使ってみた。
よくあるスライド切替をvue.js + jQuery + jQuery.bxSliderで。

スライド画像が繰り返される部分にv-repeatを設定

index.jade

ul(id='slide')
    li(v-repeat='photos')
        img(src="{{photo}}", alt="{{title}}")

vue.jsで要素を描画してからjQueryプラグインを適用

index.js

var slide = new Vue({
        el: '#slide',
        data: {
            photos: [
                {
                    "photo": "画像1のパス",
                    "title": "画像1の名前"
                },
                {
                    "photo": "画像2のパス",
                    "title": "画像2の名前"
                }
            ]
        }
    });
    jQuery("#slide").bxSlider();

これで行けました。

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