|
@@ -62,6 +62,11 @@ export default {
|
|
|
default: ''
|
|
|
}
|
|
|
},
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ pageInformation: null
|
|
|
+ }
|
|
|
+ },
|
|
|
computed: {
|
|
|
currentPage: {
|
|
|
get () {
|
|
@@ -92,6 +97,7 @@ export default {
|
|
|
if (this.sync) {
|
|
|
const searchs = new Searchs(this.saveKey || this.$route.path)
|
|
|
const active = searchs.get()
|
|
|
+ this.pageInformation = active
|
|
|
if (active && active.page) {
|
|
|
for (const key in active.page) {
|
|
|
if (active.page.hasOwnProperty(key)) {
|
|
@@ -105,8 +111,14 @@ export default {
|
|
|
searchs.update(this.$route.path, undefined, 'bind')
|
|
|
}
|
|
|
}
|
|
|
+ window.addEventListener('watchStorage', this.watchStorage)
|
|
|
},
|
|
|
methods: {
|
|
|
+ watchStorage() {
|
|
|
+ let page = this.pageInformation && this.pageInformation.page ? this.pageInformation.page : null
|
|
|
+ this.currentPage = page && page.page ? page.page : 1
|
|
|
+
|
|
|
+ },
|
|
|
syncStore() {
|
|
|
if (this.sync) {
|
|
|
const searchs = new Searchs(this.saveKey || this.$route.path)
|
|
@@ -127,6 +139,9 @@ export default {
|
|
|
}
|
|
|
this.syncStore()
|
|
|
}
|
|
|
+ },
|
|
|
+ destroyed() {
|
|
|
+ window.removeEventListener('watchStorage', this.watchStorage)
|
|
|
}
|
|
|
}
|
|
|
</script>
|