Browse Source

Fix an issue where a query state and a filter state are not synchronized

pull/897/head
Hironsan 4 years ago
parent
commit
410658f321
2 changed files with 18 additions and 4 deletions
  1. 21
      frontend/components/containers/annotation/FilterButton.vue
  2. 1
      frontend/layouts/annotation.vue

21
frontend/components/containers/annotation/FilterButton.vue

@ -41,9 +41,16 @@
<script>
export default {
props: {
value: {
type: String,
default: '',
required: true
}
},
data() {
return {
selected: 0,
items: [
{ title: 'All', param: '' },
{ title: 'Done', param: 'false' },
@ -52,9 +59,15 @@ export default {
}
},
watch: {
selected() {
this.$emit('input', this.items[this.selected].param)
computed: {
selected: {
get() {
const index = this.items.findIndex(item => item.param === this.value)
return index === -1 ? 0 : index
},
set(value) {
this.$emit('input', this.items[value].param)
}
}
}
}

1
frontend/layouts/annotation.vue

@ -126,6 +126,7 @@ export default {
this.$router.push({
query: {
isChecked: newValue,
page: 1,
q: this.$route.query.q
}
})

Loading…
Cancel
Save