vue 实现横向滑动

<template>
  <div class="sliding_box">
    <div class="sliding_item" v-for="(item,index) in content" :key="index">
      <div class="sliding_item_img">
	</div>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      content: 3
    }
  }
}
</script>
 
<style scoped>
.sliding_box{
  display: flex;
  overflow-y: hidden;
  overflow-x: scroll;
}
.sliding_item{
  display: flex;
  margin-right: 8px;
  background-color: #CDCDCD;
}
.sliding_item_img {
  width: 200px;
  height: 100px;
}
 
</style>

你可能感兴趣的:(vue)