grid网格布局实现图表框架(vue)

需求

需要实现一个如图所示的界面

实现

用grid布局来实现 

      <div class="inner">
        <div v-for="(item, index) in componentList" :key="item.id" :class="'comp' + index">
          <component
            :is="item.component"
            :title="item.name"
          ></component>
        </div>
      </div>
      

const componentList = [
  {
    name: "comp1",
    component: comp1,
  },
  {
    name: "comp2",
    component: comp2,
  },
  {
    name: "comp3",
    component: comp3,
  },
  {
    name: "comp4",
    component: comp4,
  },
  {
    name: "comp5",
    component: comp5,
  },
  {
    name: "comp6",
    component: comp6,
  },
  {
    name: "comp7",
    component: comp7,
  },
  {
    name: "comp8",
    component: comp8,
  },
  {
    name: "comp9",
    component: comp9,
  },
];


      // css (stylus)
      .inner
        display: grid
        justify-content: center
        grid-template-columns: vw(430) vw(372) vw(579) vw(430)
        grid-template-rows: repeat(3, vh(310))
        grid-gap: vw(15) vw(20)
        .comp0
          grid-row: 1
          grid-column: 1
        .comp1
          grid-row: 1 / span 2
          grid-column: 2 / span 2
        .comp2
          grid-row: 1
          grid-column: 4
        .comp3
          grid-row: 2
          grid-column: 1
        .comp4
          grid-row: 2
          grid-column: 4
        .comp5
          grid-row: 3
          grid-column: 1
        .comp6
          grid-row: 3
          grid-column: 2
        .comp7
          grid-row: 3
          grid-column: 3
        .comp8
          grid-row: 3
          grid-column: 4

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值