
<template>
<div class="bigBox">
<div class="smallBox" :style="{'width':width}" v-for="item in 10" :key="item">
<div class="contentItem">{{ item }}</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
width: '20%'
};
},
created() {
this.width = 100 / Math.trunc(window.innerWidth / 200) + '%';
window.addEventListener('resize', this.reSizer);
},
destroyed() {
window.removeEventListener('resize', this.reSizer);
},
methods: {
reSizer() {
this.width = 100 / Math.trunc(window.innerWidth / 200) + '%';
}
}
};
</script>
<style scoped lang="scss">
.bigBox {
display: flex;
flex-wrap: wrap;
.smallBox {
padding: 10px;
.contentItem {
height: 200px;
border: 1px solid black;
}
}
}
</style>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43