页面四个菜单flex布局
<template>
<div class="order-header">
<h4>基本信息</h4>
<div class="order-flex">
<div class="order-div" v-for="(item, index) in dataOrder" :key="index">
<div class="order-for" :class="item.class">
<div class="img">
<img :src="item.src" />
</div>
<div class="flex-r">
<h3>{{ toFixed(item.num) }}</h3>
<div>{{ item.name }}</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "Home",
components: {},
data() {
return {
dataOrder: [
{
src: require("./logo.png"),
name: "这里是汉字",
num: 39,
class: "order0",
},
{
src: require("./logo.png"),
name: "这里是汉字",
num: 1239,
class: "order1",
},
{
src: require("./logo.png"),
name: "这里是汉字",
num: 9,
class: "order2",
},
{
src: require("./logo.png"),
name: "这里是汉字",
num: 12239,
class: "order3",
},
],
};
},
methods: {
toFixed(num) {
return parseFloat(num).toLocaleString("en", {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
});
},
},
mounted() {},
};
</script>
<style lang="scss" scoped>
.order-header {
font-size: 18px;
color: #333333;
padding: 20px;
.order-flex {
display: flex;
align-items: center;
justify-content: space-between;
.order-div {
margin-bottom: 20px;
margin-top: 20px;
.order0 {
background: linear-gradient(316deg, #ff7271 0%, #ffabab 100%);
box-shadow: 0px 2px 20px 0px rgba(255, 115, 114, 0.2);
}
.order1 {
background: linear-gradient(316deg, #ffab73 0%, #ffccaa 100%);
box-shadow: 0px 2px 20px 0px rgba(255, 172, 116, 0.2);
}
.order2 {
background: linear-gradient(316deg, #96b6e2 0%, #bed3ec 100%);
box-shadow: 0px 2px 20px 0px rgba(151, 183, 226, 0.2);
}
.order3 {
background: linear-gradient(316deg, #858ed0 0%, #b6bae3 100%);
box-shadow: 0px 2px 20px 0px rgba(134, 143, 208, 0.2);
}
.order-for {
display: flex;
align-items: center;
border-radius: 8px;
width: 280px;
height: 88px;
.img {
width: 48px;
height: 48px;
margin-left: 20px;
img {
width: 100%;
height: 100%;
}
}
.flex-r {
color: #ffffff;
margin-left: 20px;
h3 {
font-weight: bold;
font-size: 32px;
line-height: 32px;
height: 32px;
}
div {
font-size: 14px;
line-height: 16px;
height: 16px;
margin-top: 2px;
}
}
}
}
}
}
</style>
<template>
<div class="order-header">
<h4>基本信息</h4>
<div class="order-flex">
<div class="order-div" v-for="(item, index) in dataOrder" :key="index">
<div class="order-for" :class="item.class">
<div class="img">
<img :src="item.src" />
</div>
<div class="flex-r">
<h3>{{ toFixed(item.num) }}</h3>
<div>{{ item.name }}</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "Home",
components: {},
data() {
return {
dataOrder: [
{
src: require("./logo.png"),
name: "这里是汉字",
num: 39,
class: "order0",
},
{
src: require("./logo.png"),
name: "这里是汉字",
num: 1239,
class: "order1",
},
{
src: require("./logo.png"),
name: "这里是汉字",
num: 9,
class: "order2",
},
{
src: require("./logo.png"),
name: "这里是汉字",
num: 12239,
class: "order3",
},
],
};
},
methods: {
toFixed(num) {
return parseFloat(num).toLocaleString("en", {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
});
},
},
mounted() {},
};
</script>
<style lang="scss" scoped>
.order-header {
font-size: 18px;
color: #333333;
padding: 20px;
.order-flex {
display: flex;
align-items: center;
justify-content: space-between;
.order-div {
margin-bottom: 20px;
margin-top: 20px;
.order0 {
background: linear-gradient(316deg, #ff7271 0%, #ffabab 100%);
box-shadow: 0px 2px 20px 0px rgba(255, 115, 114, 0.2);
}
.order1 {
background: linear-gradient(316deg, #ffab73 0%, #ffccaa 100%);
box-shadow: 0px 2px 20px 0px rgba(255, 172, 116, 0.2);
}
.order2 {
background: linear-gradient(316deg, #96b6e2 0%, #bed3ec 100%);
box-shadow: 0px 2px 20px 0px rgba(151, 183, 226, 0.2);
}
.order3 {
background: linear-gradient(316deg, #858ed0 0%, #b6bae3 100%);
box-shadow: 0px 2px 20px 0px rgba(134, 143, 208, 0.2);
}
.order-for {
display: flex;
align-items: center;
border-radius: 8px;
width: 280px;
height: 88px;
.img {
width: 48px;
height: 48px;
margin-left: 20px;
img {
width: 100%;
height: 100%;
}
}
.flex-r {
color: #ffffff;
margin-left: 20px;
h3 {
font-weight: bold;
font-size: 32px;
line-height: 32px;
height: 32px;
}
div {
font-size: 14px;
line-height: 16px;
height: 16px;
margin-top: 2px;
}
}
}
}
}
}
</style>