【发布时间】:2017-07-26 20:53:59
【问题描述】:
我找不到在 v-for 中选择不同选项来呈现文本的方法。是否有可能或者我需要以不同的方式构造逻辑来执行以下代码之类的操作?
<template>
<ul v-show="showNotifications">
<li v-for="notification in notifications">
// if notification.type = 'friend request'
New friend request from {{ notification.name }}
// else
New notification from {{ notification.name }}
</li>
</ul>
</template>
Notification 是一个包含名称和通知类型等数据的对象数组。
【问题讨论】:
标签: vuejs2