mirror of https://github.com/halo-dev/halo-admin
feat: 新增地址栏记录查询条件功能#60 (#65)
parent
643cf5524c
commit
0d6ebd0733
|
@ -630,12 +630,34 @@ export default {
|
||||||
this.postSettingVisible = false
|
this.postSettingVisible = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeRouteEnter(to, from, next) {
|
||||||
|
next(vm => {
|
||||||
|
vm.queryParam.page = to.query.page
|
||||||
|
vm.queryParam.size = to.query.size
|
||||||
|
vm.queryParam.sort = to.query.sort
|
||||||
|
vm.queryParam.keyword = to.query.keyword
|
||||||
|
vm.queryParam.categoryId = to.query.categoryId
|
||||||
|
vm.queryParam.status = to.query.status
|
||||||
|
})
|
||||||
|
},
|
||||||
beforeRouteLeave(to, from, next) {
|
beforeRouteLeave(to, from, next) {
|
||||||
if (this.postSettingVisible) {
|
if (this.postSettingVisible) {
|
||||||
this.postSettingVisible = false
|
this.postSettingVisible = false
|
||||||
}
|
}
|
||||||
next()
|
next()
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
queryParam: {
|
||||||
|
deep: true,
|
||||||
|
handler: function(newVal, oldVal) {
|
||||||
|
if (newVal) {
|
||||||
|
const params = JSON.parse(JSON.stringify(this.queryParam))
|
||||||
|
const path = this.$router.history.current.path
|
||||||
|
this.$router.push({ path, query: params }).catch(err => err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loadPosts() {
|
loadPosts() {
|
||||||
this.postsLoading = true
|
this.postsLoading = true
|
||||||
|
|
Loading…
Reference in New Issue