|
@@ -90,18 +90,18 @@ export default { |
|
|
pagination: { |
|
|
pagination: { |
|
|
pageCount: 1, |
|
|
pageCount: 1, |
|
|
perPage: 5, |
|
|
perPage: 5, |
|
|
currentPage: 1 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
currentPage: 1, |
|
|
|
|
|
}, |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
components: { |
|
|
components: { |
|
|
PasswordProfile, |
|
|
PasswordProfile, |
|
|
Paginate |
|
|
|
|
|
|
|
|
Paginate, |
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
computed: { |
|
|
...mapState(["passwords"]), |
|
|
...mapState(["passwords"]), |
|
|
filteredPasswords() { |
|
|
filteredPasswords() { |
|
|
const passwords = this.passwords.filter(password => { |
|
|
|
|
|
|
|
|
const passwords = this.passwords.filter((password) => { |
|
|
var loginMatch = password.login.match( |
|
|
var loginMatch = password.login.match( |
|
|
new RegExp(this.searchQuery, "i") |
|
|
new RegExp(this.searchQuery, "i") |
|
|
); |
|
|
); |
|
@@ -113,17 +113,17 @@ export default { |
|
|
this.pagination.perPage, |
|
|
this.pagination.perPage, |
|
|
this.pagination.currentPage * this.pagination.perPage |
|
|
this.pagination.currentPage * this.pagination.perPage |
|
|
); |
|
|
); |
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
watch: { |
|
|
watch: { |
|
|
filteredPasswords: { |
|
|
filteredPasswords: { |
|
|
deep: true, |
|
|
deep: true, |
|
|
handler: function(newVal) { |
|
|
|
|
|
|
|
|
handler: function () { |
|
|
this.pagination.pageCount = Math.ceil( |
|
|
this.pagination.pageCount = Math.ceil( |
|
|
newVal.length / this.pagination.perPage |
|
|
|
|
|
|
|
|
this.passwords.length / this.pagination.perPage |
|
|
); |
|
|
); |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
beforeMount() { |
|
|
beforeMount() { |
|
|
this.$store.dispatch("getPasswords"); |
|
|
this.$store.dispatch("getPasswords"); |
|
@@ -131,7 +131,7 @@ export default { |
|
|
methods: { |
|
|
methods: { |
|
|
setCurrentPage(page) { |
|
|
setCurrentPage(page) { |
|
|
this.pagination.currentPage = page; |
|
|
this.pagination.currentPage = page; |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
}; |
|
|
}; |
|
|
</script> |
|
|
</script> |