第一步
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>
网友评论