Skip to content

Instantly share code, notes, and snippets.

@justinbmeyer
Created July 19, 2018 02:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinbmeyer/7c26155785b480b2b151aabeff037a54 to your computer and use it in GitHub Desktop.
Save justinbmeyer/7c26155785b480b2b151aabeff037a54 to your computer and use it in GitHub Desktop.
<my-paginate offset:from='0' limit:from='20'></my-paginate>

<script type="module">
import {Component} from "can";

Component.extend( {
	tag: "my-paginate",
	ViewModel: {
		offset: { default: 0 },
		limit: { default: 20 },
		get page() {
			return Math.floor( this.offset / this.limit ) + 1;
		}
	},
	view: "Page {{page}}."
} );
</script>

@codepen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment