UNPKG

can

Version:

MIT-licensed, client-side, JavaScript framework that makes building rich web applications easy.

25 lines (23 loc) 680 B
<body> <div id='out'></div> <script src="../../node_modules/steal/steal.js" main="@empty"></script> <script type='text/javascript'> steal("can/component", "can/view/stache",function() { can.Component.extend({ tag: "my-paginate", viewModel: { offset: 0, limit: 20, next: function(){ this.attr("offset", this.offset + this.limit); }, page: function(){ return Math.floor(this.attr('offset') / this.attr('limit')) + 1; } }, template: can.stache("Page {{page}} <button ($click)='next()'>Next</button>") }); $("#out").html(can.stache("<my-paginate/>")({})); }); </script> </body>