我无法找到一种方法来选择不同的选项来渲染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>
Run Code Online (Sandbox Code Playgroud)
通知是一组对象,其中包含名称和通知类型等数据.
我似乎无法找到是什么原因造成的。我一遍又一遍地检查这个网址,但我似乎找不到它有什么问题。
function setTime() {
min = $("#minutes").val();
hour = $("select").val();
odG = $("#odGodina").val();
doG = $("#doGodina").val();
dat = $("#datepicker").val();
dat = dat.split("/"); //mm.dd.YYYY
vreme = new Date(dat[2], dat[0], dat[1], hour, min);
sendInput(vreme);
}
function sendInput(time) {
console.log(time.getTime());
var url = "https://maps.googleapis.com/maps/api/timezone/json?location="+lat+","+lngt+"×tamp="+time.getTime()+"&sensor=false";
var testResenje = $.ajax({
url: url,
}).done(function(response) {
offset = response.rawOffset / 3600 + response.dstOffset / 3600;
sendResponse();
console.log(offset);
});}
Run Code Online (Sandbox Code Playgroud)
获取构建的 url 是:
long 和 lat 的字符数有问题吗?
还是我的函数顺序不好?
编辑:事实证明,如果我在时间戳中少一个字符,它就可以工作。这是否意味着我无法使用当前时间?