flex布局,控制每行显示几个

flex布局,控制每行显示几个_第1张图片
代码

<template>
  <div class="ocr">
     <div class="img">
         <img :src="url" alt="">
         <img :src="url" alt="">
         <img :src="url" alt="">
         <img :src="url" alt="">
         <img :src="url" alt="">
     </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
        url:"https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1451305371,2341613622&fm=26&gp=0.jpg"
    };
  }
};
</script>
<style lang="less" scoped>
.ocr{
    .img{
        width: 800px;
        border: 1px solid red;
        display: flex;
        flex-wrap: wrap;
        justify-content: start;
        img{
            width: 116px;
            height: 150px;
            flex: 0 0 33%;
        }
    }
}
</style>

你可能感兴趣的:(Vue)