0
1

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.

Nuxt.jsでvue-slickを使う

Last updated at Posted at 2020-12-11

前提条件

これを設定している

インストール

$ npm i -S vue-slick jquery slick-carousel

使う

slider.vue
<template lang="pug">
.slider
  client-only
    Slick(:options="slickOptions")
      .slider-item(v-for="i in 3" :key="i")
        img(src="https://placehold.jp/150x150.png")
</template>

<script>
import '~/node_modules/slick-carousel/slick/slick.css'

export default {
  components: {
    Slick: () => process.browser ? import('vue-slick') : null,
  },
  data: () => ({
    slickOptions: {
      swipe: true, // スワイプできるか
      slidesToShow: 1, // スライドを何個表示するか
      infinite: true, // ループさせるか
      vertical: false, // 縦に表示するか
      verticalSwiping: false, // 縦にスワイプできるか
      draggable: true, // マウスでドラッグできるか
      arrows: true, // アローを使うか
      prevArrow: '<div class="slide-prev"></div>', // 戻るアローのdomを指定
      nextArrow: '<div class="slide-next"></div>' // 次へアローのdomを指定
    }
  })
}
</script>

<style lang="stylus" scoped>
.slider
  img
    width 100%
</style>

Nuxt.jsのそのほか

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?