vue的无缝滚动组件vue-seamless-scroll实例(2)

import Vue from 'vue'
import vueSeamlessScroll from 'vue-seamless-scroll'

new Vue({
 components: {
  vueSeamlessScroll
 }
})

普通模式 (script tag)

Example:

<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport"
       content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
      .warp {
        height: 260px;
        width: 360px;
        overflow: hidden;
      }
      .warp ul {
        list-style: none;
        padding: 0;
        margin: 0 auto;
      }
      .warp li {
        height: 30px;
        line-height: 30px;
        display: flex;
        justify-content: space-between;
        font-size: 15px;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <vue-seamless-scroll :data="listData" :class-option="classOption"
                 @copy-data="listData = listData.concat(listData)"
                 class="warp">
        <ul class="item">
          <li v-for="item in listData"><span class="title" v-text="item.title"></span><span class="date"
                                                   v-text="item.date"></span>
          </li>
        </ul>
      </vue-seamless-scroll>
    </div>
    <script src="https://cdn.bootcss.com/vue/2.5.9/vue.js"></script>
    <script src="../dist/vue-seamless-scroll.min.js"></script>
    <script>
     new Vue({
      el: '#app',
      data: {
       listData: [{
        'title': '无缝滚动第一行无缝滚动第一行',
        'date': '2017-12-16'
       }, {
        'title': '无缝滚动第二行无缝滚动第二行',
        'date': '2017-12-16'
       }, {
        'title': '无缝滚动第三行无缝滚动第三行',
        'date': '2017-12-16'
       }, {
        'title': '无缝滚动第四行无缝滚动第四行',
        'date': '2017-12-16'
       }, {
        'title': '无缝滚动第五行无缝滚动第五行',
        'date': '2017-12-16'
       }, {
        'title': '无缝滚动第六行无缝滚动第六行',
        'date': '2017-12-16'
       }, {
        'title': '无缝滚动第七行无缝滚动第七行',
        'date': '2017-12-16'
       }, {
        'title': '无缝滚动第八行无缝滚动第八行',
        'date': '2017-12-16'
       }, {
        'title': '无缝滚动第九行无缝滚动第九行',
        'date': '2017-12-16'
       }]
      },
      computed: {
       classOption: function () {
        return {
         step: 0.5,
         limitMoveNum: 5
        }
       }
      }
     })
    </script>
  </body>
</html>
<html>
<head>
 ...
</head>
<body>
 <div id="app">
  <vue-seamless-scroll></vue-seamless-scroll>
 </div>
 <script src="vue.js"></script>
 <script src="vue-seamless-scroll"></script>
 <script>
  new Vue({
   el: '#app'
  })
 </script>
</body>
</html>
      

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/180.html