【发布时间】:2020-06-16 14:55:40
【问题描述】:
我现在将一个事件对象转储到控制台,它由 id、日期、类别和一组通知组成(数组中的每个项目都有 notification_type 和 notification_message)
在控制台中是这样的:
0:
iD: 123
date: "2020/03/03"
category: "New"
notifications: Array(2)
0:
notification_type: "new notification"
notification_message: "teting notifications"
1:
notification_type: "internal notification"
notification_message: "teting internal"
所以我在主事件对象上有我的 vue for 循环,它工作正常,除了我不知道如何在那里获得评论。基本上,我希望它只显示新通知类型的消息:
<tr v-for="event in events">
<td>{{ event.id }}</td>
<td>{{event.date}}</td>
<td>{{event.category}}</td>
<td v-if="event.notifications.notification_type === 'new notification'">{{event.notifications.notification_message}}</td>
</tr>
这仍然会加载除通知之外的所有内容,通知根本没有加载。
如何更改此设置以仅获取此表格数据单元格上的“新通知”值?
【问题讨论】:
-
N 这是一个错字
event.notifications.notification_type而不是event.Notifications.notification_type? -
@YashwardhanPauranik 刚刚修好了,这里不小心把数组名大写了,其实是小写的
-
另外,
Category: "New"键是否可以用来查看新通知? -
@YashwardhanPauranik 不,类别与产品有关(新的、二手的、转售等)
标签: javascript vue.js