1. 程式人生 > >安裝vue2.0中vue-easy-slider的滑塊元件外掛

安裝vue2.0中vue-easy-slider的滑塊元件外掛

安裝 npm i -S vue-easy-slider

demo1:


<template>
	<slider animation="fade">
  <slider-item v-for="(i, index) in list" :key="index">
    <div :style="i">
      <p style="line-height: 280px; font-size: 5rem; text-align: center;">Page{{ index + 1 }}</p>
    </div>
  </slider-item>
</slider>
</template>

<script>
import { Slider, SliderItem } from 'vue-easy-slider'

export default{
  data :function() {
    return {
      list: [
        { backgroundColor: '#3f51b5', width: '100%', height: '100%' },
        { backgroundColor: '#eee', width: '100%', height: '100%' },
        { backgroundColor: '#f44336', width: '100%', height: '100%' },
      ],
    }
  },
  components: {
    Slider,
    SliderItem
  }
} 
</script>
<style>

</style>

效果: