代码如下:
<template>
<div>
<h1>测试flex</h1>
<div class="flex">
<div class="flex-one">我是第一行</div>
<div class="flex-two">我是第二行的数据</div>
<div class="flex-three">
<div class="flex-three-item" v-for=" item in 13" :key="item"></div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'testFlex',
components: {},
data() { return {} },
created() {},
computed: {},
methods: {},
mounted() { }}
</script>
<style lang="scss" scoped>
.flex {
width: 500px;
height: 300px;
background-color: pink;
margin: 0 auto;
overflow: auto;
display: flex;
justify-content: center;
align-items: center;
align-content:center;
flex-flow: column;
&-three {
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
&-item {
width: 100px;
height: 100px;
background-color: aqua;
margin: 5px;
}
}
}
</style>
<template>
<div>
<h1>测试flex</h1>
<div class="flex">
<div class="flex-one">我是第一行</div>
<div class="flex-two">我是第二行的数据</div>
<div class="flex-three">
<div class="flex-three-item" v-for=" item in 13" :key="item"></div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'testFlex',
components: {},
data() { return {} },
created() {},
computed: {},
methods: {},
mounted() { }}
</script>
<style lang="scss" scoped>
.flex {
width: 500px;
height: 300px;
background-color: pink;
margin: 0 auto;
overflow: auto;
display: flex;
justify-content: center;
align-items: center;
align-content:center;
flex-flow: column;
&-three {
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
&-item {
width: 100px;
height: 100px;
background-color: aqua;
margin: 5px;
}
}
}
</style>