页面四个菜单flex布局--均匀排布自适应

页面四个菜单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>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值