cola(function (model) { model.describe("companies", { provider: "//open-data.cola-ui.com/service/company" }); model.action({ each: function(){ var companies = model.get("companies"); if (companies != null) { var names = []; companies.each(function(company) { names.push(company.get("name")); }); cola.alert(names.join(", ")); } } }); });
<c-button c-onclick="each()">遍历所有公司</c-button> <hr> <ul> <li c-repeat="company in companies" c-bind="company.name"></li> </ul>