vue v-for 同时遍历两个组数

思路  

  1. v-for 利用item 遍历一个数组 利用index 遍历另外一个数组
  2. 两个数组要求长度相同
  3.  再要一块才可以 div中  例子   v-for inte in list   第二个v-for  是   v-for children in  inte.childred

ru  

computed: {
			newIconIsShow: function() {
				let _this = this
				let item = this.itemInfo.articleList
				let arr = []
				for (let i = 0; i < item.length; i++) {
					let res = compareTime(item[i].releaseTime, 99)
					arr.push(res)
				}
				console.log(arr)
				return arr
			}

遍历文章信息系 

<div class="list-item" v-for="(item,index) in itemInfo.articleList" :key="index" @click="newsClick(item.id)">
					<div class="item-left">
						<p class="text_p">.&nbsp;{{item.title}}</p>
					</div>

					<div class="item-right">
						<new-icon v-show="newIconIsShow[index]"></new-icon>
						<span class="pubTime">{{item.releaseTime}}</span>
					</div>
				</div>

index 每一项 

v-for 利用item 遍历一个数组 利用index 遍历另外一个数组:我这里利用item遍历了articleList数组,利用index遍历newIconIsShow数组

两个数组要求长度相同

相关推荐

  1. vue v-for 同时

    2024-04-01 18:42:04       17 阅读
  2. 【链表】-Lc21-合并有序链表(同时

    2024-04-01 18:42:04       34 阅读
  3. 的列

    2024-04-01 18:42:04       36 阅读
  4. 和里面的对象

    2024-04-01 18:42:04       39 阅读
  5. Flutter循环获取索引值

    2024-04-01 18:42:04       43 阅读
  6. uniapp对象的常见方法

    2024-04-01 18:42:04       13 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-04-01 18:42:04       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-01 18:42:04       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-01 18:42:04       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-01 18:42:04       20 阅读

热门阅读

  1. 使用C++ opencv创建小视口

    2024-04-01 18:42:04       15 阅读
  2. redis 常用命令

    2024-04-01 18:42:04       15 阅读
  3. docker run 使用 -p 命令一直显示端口被占用

    2024-04-01 18:42:04       17 阅读
  4. git 更改仓库地址

    2024-04-01 18:42:04       19 阅读
  5. 2024.2.6力扣每日一题——魔塔游戏

    2024-04-01 18:42:04       17 阅读
  6. Python 树结构库treelib使用教程

    2024-04-01 18:42:04       15 阅读
  7. npm常用命令详解

    2024-04-01 18:42:04       15 阅读
  8. 蓝桥杯备考随手记: practise03

    2024-04-01 18:42:04       13 阅读
  9. git - - - 克隆仓库时输入指定账号和密码

    2024-04-01 18:42:04       15 阅读