我需要首先根据用户选择的日期是过去还是将来设置Backbone视图的模板,以及稍后当它的集合更改从不同的日期拉取数据时再切换它.我该怎么做呢?我以为我能够将模板设置为一个函数,该函数根据我是否过去返回正确的选择器字符串,但这不起作用.
pR.views.ScheduleJobView = Backbone.Marionette.ItemView.extend({
tagName: "tr",
// NEED A WAY TO SWITCH THIS TOO
template: "#schedule-job-template"
});
pR.views.ScheduleJobsView = Backbone.Marionette.CompositeView.extend({
// DOESN'T WORK
template: function () {
if (this.isPast)
return "#schedule-jobs-past-template";
else
return "#schedule-jobs-template";
}, itemView: pR.views.ScheduleJobView,
itemView: pR.views.ScheduleJobView,
itemViewContainer: "tbody",
// Defaults for the model's url
baseUrl: "/schedules/day/",
baseApiUrl: "/api/schedule/day/",
// Empty object to store url parameters
urlParameters: {},
initialize: function () {
pR.vent.bindTo("change:parameters", this.changeUrl, this);
this.model.url = this.baseApiUrl;
},
onRender: function () {
console.log("Rendering Jobs View");
},
// …Run Code Online (Sandbox Code Playgroud) 我正在尝试scp目录中的三个最新文件.现在我用它ls -t | head -3来找出他们的名字,然后在scp命令中写出来,但这变得很艰难.我尝试使用,ls -t | head -3 | scp *username*@*address*:*path*但这没用.最好的方法是什么?
javascript ×2
backbone.js ×1
bash ×1
immutability ×1
immutable.js ×1
marionette ×1
reactjs ×1
scp ×1