0
呈現
我ItemView控件沒有被我的CompositeView中呈現木偶:<br/><br/></p> <p>我app.js:ItemView控件不CompositeView中
var express= require("express"),
bodyparser= require("body-parser");
var app= express();
app.use(express.static(__dirname+ "/public"));
app.use(bodyparser.json());
app.use(bodyparser.urlencoded({extended: true}));
app.get("/*", function(req, res){
res.render("index.jade");
});
app.listen(3002);
app.js呼籲index.jade:
doctype html
#nexter
script(id="tabler" type="text/template").
<table>
<thead>
<tr id="check"> <td> One </td> </tr>
</thead>
<tbody id="tbody1">
</tbody>
</table>
script(id="urview", type="text/template")
<tr> <td> <p> Many </p> </td> </tr>
<tr> <td> <p> Any </p> </td> </tr>
script(src= "/jquery.js")
script(src= "/underscore.js")
script(src= "/backbone.js")
script(src= "/backbone.marionette.js")
script(src= "/theapp.js")
index.jade調用theapp.js:
var Usertracker= new Marionette.Application();
var Uview= Marionette.ItemView.extend({
template: "#urview",
el: "#tbody1"
});
var Usercompositeview= Marionette.CompositeView.extend({
template: "#tabler",
itemView: Uview,
events: {
"click #check": "eventer"
},
eventer: function(){
$("p").css("background-color", "yellow");
$("tr").css("background-color", "orange");
}
});
Usertracker.addRegions({
nexter: "#nexter"
});
Usertracker.addInitializer(function(){
Usertracker.nexter.show(new Usercompositeview({}));
});
Usertracker.start();
我將獲得One
作爲輸出,其顏色在點擊時發生變化。 但我不能得到Many
和Any
作爲輸出!
需要幫助,謝謝!