<div :style="picShow">
<div style="width: 100px;float: left;margin-right: 20px;" v-for="(item,index) in picItem">
<img :src="item" alt="" style="width: 100px;height:100px;border-radius: 5px;" >
</div>
</div>
data: function () {
return {
picItem: ["./a1.jpg", "./a1.jpg", "./a1.jpg", "./a1.jpg", "./a1.jpg", "./a1.jpg", "./a1.jpg", "./a1.jpg"],
picShow: {
height: "100px",
width: ""
},
}
},
mounted() {
this.picShow.width=this.getWidth()
},
methods: {
getWidth() {
let index = this.picItem.length
let num = Number(index) * 120 + "px"
return num
},
}