groot.view("myview", function (vm, ve) { ve.loada = function () { require("./app/pagea.js").loadpage($("#app"), "myapp") } ve.loadb = function () { require("./app/pageb.js").loadpage($("#app"), "myapp") } })
exports.loadpage = function (element, id) { var moudle = groot.view(id, function (vm, ve) { ve.hello = function () { alert("bbb"); } }) var html = require("./pageb.html!text"); element.html(groot.createElement(html, id)); groot.sweep(moudle, element); }
请上官网,下载单页面引用的demo