美文网首页
vue-seamless-scroll

vue-seamless-scroll

作者: 码农界四爷__King | 来源:发表于2023-06-15 17:14 被阅读0次

    第一步

    npm install vue-seamless-scroll -save
    

    第二步

    import scroll from 'vue-seamless-scroll'
    Vue.use(scroll)
    

    第三步

    <template>
      <vue-seamless-scroll :data="list" class="warp" :class-option="classOption">
        <table>
          <tr
            v-for="(item, index) in list"
            :key="index"
            @click.stop="handleDetail(item)"
          >
            <td>{{ index + 1 }}</td>
            <td>{{ item.city }}</td>
          </tr>
        </table>
      </vue-seamless-scroll>
    </template>
    
    <script>
    export default {
      data() {
        return {
          classOption: {
            step: 0.2,
            limitMoveNum: 5,
          },
          list: [
            { city: "北京" },
            { city: "上海" },
            { city: "广州" },
            { city: "深圳" },
            { city: "成都" },
            { city: "杭州" },
            { city: "天津" },
            { city: "青岛" },
            { city: "大连" },
            { city: "沈阳" },
            { city: "济南" },
            { city: "石家庄" },
            { city: "天津" },
            { city: "西安" },
            { city: "烟台" },
            { city: "徐州" },
          ],
        };
      },
    };
    </script>
    <style scoped>
    .warp {
      height: 200px;
      overflow: hidden;
    }
    </style>
    

    相关文章

      网友评论

          本文标题:vue-seamless-scroll

          本文链接:https://www.haomeiwen.com/subject/qkylydtx.html