Skip to content

Instantly share code, notes, and snippets.

@12cassie34
Created January 4, 2022 09:58
Show Gist options
  • Save 12cassie34/71e806742334adebdda4597b9858d978 to your computer and use it in GitHub Desktop.
Save 12cassie34/71e806742334adebdda4597b9858d978 to your computer and use it in GitHub Desktop.
Vue Pagination - Step2-3
computed: {
totalPages: function() {
return Math.ceil(this.dataAmount / this.itemsPerPage)
},
currentContents: function() {
// 檢查 Array 的資料是否為空
if (!this.cities || this.cities.length != this.cities.length) {
return;
}
this.dataAmount = this.cities.length;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment