vantUI的轮播图一个里面放两个小模块写法,转二维数组

      <!-- 未处理报警 -->
      <div style="height:30%;display: flex;flex-direction: column;">
        <span class="box-title-mini">{{ $t('i18n.unprocessedalarm') }}</span>
        <div style="height: calc(100% - 41px);width: 100%;">

          <!-- <div class="info-container color-frame" style="margin-top:5px;" v-for="item in alarmInfoList" :key="item.id"
            @click="callsss(item.alarmMsg)">
            <span class="text_space" style="font-size: 1.1rem;   font-weight:bold">{{ item.alarmMsg }}</span>
            <span style="font-size: 0.9rem;  ">{{ $t('i18n.occurrenceTime') }}&nbsp;:</span>
            <span style="font-size: 0.9rem;  ">{{ item.startTime }}</span>
          </div> -->
          <van-swipe :autoplay="3000" :loop="false" indicator-color="#39a9ed">
            <van-swipe-item v-for="(item, index) in alarmInfoList" :key="index">
              <unprocessedalarm ref="unprocessedalarmREF" :unprocessedalarm="item"></unprocessedalarm>
            </van-swipe-item>
          </van-swipe>

        </div>
      </div>
private async getWranInfo(flowmeterId) {
    this.alarmInfoList = []
    // 获取流量计所有为处理的报警接口
    let res = await GetAllAlarmsNotDeal(flowmeterId)
    let untreated = res.filter((item) => {
      return item.isDeal == false
    })

    for (let i = 0; i < untreated.length; i += 2) {
      this.alarmInfoList.push(res.slice(i, i + 2))
    }
    console.log('this.alarmInfoList', this.alarmInfoList)
  }

下面是个组件,一页面两行的组件,

<template>
  <div class="workArea-container" :style="{ 'justify-content': unprocessedalarm.length == 2 ? 'space-between' : 'flex-start' }">
    <div style="height:90%;width:49%;" class="workArea">
      <div class="info-container color-frame" :style="{ 'justify-content': unprocessedalarm.length == 2 ? 'space-between' : 'flex-start' }">
        <span class="text_space" style="font-size: 1.1rem;   font-weight:bold">{{ unprocessedalarm[0].alarmMsg }}</span>
        <div>
          <span style="font-size: 0.9rem;  ">{{ $t('i18n.occurrenceTime') }}&nbsp;:</span><br />
          <span style="font-size: 0.9rem;  ">{{ unprocessedalarm[0].startTime }}</span>
        </div>
      </div>
    </div>
    <div style="height:90%;width:49%;" class="workArea">
      <div v-if="unprocessedalarm.length == 2" class="info-container color-frame"
        :style="{ 'justify-content': unprocessedalarm.length == 2 ? 'space-between' : 'flex-start' }">
        <span class="text_space" style="font-size: 1.1rem;   font-weight:bold">{{ unprocessedalarm[1].alarmMsg }}</span>
        <div>
          <span style="font-size: 0.9rem;  ">{{ $t('i18n.occurrenceTime') }}&nbsp;:</span><br />
          <span style="font-size: 0.9rem;  ">{{ unprocessedalarm[1].startTime }}</span>
        </div>
      </div>
    </div>

  </div>
</template>










  @Prop({
    default: () => {
      return []
    }
  })
  private unprocessedalarm: any

  mounted() {}

  // @Watch('unprocessedalarm', { deep: true, immediate: true })
  // private async onworkAreaItemChanged(newval: string, oldval: string) {
  //   await this.$nextTick()
  // }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值