Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 7b9685d

Browse files
authored
fix(default-theme): sync up data in some filter component (#2009)
1 parent bf0eca9 commit 7b9685d

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

packages/default-theme/src/components/listing/types/range.vue

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@
2222
</div>
2323
</template>
2424
<script>
25-
import { computed, ref } from "@vue/composition-api"
26-
25+
import { watch, ref } from "@vue/composition-api"
2726
import { SfFilter, SfHeading } from "@storefront-ui/vue"
2827
import SwInput from "@/components/atoms/SwInput.vue"
2928
import useVuelidate from "@vuelidate/core"
30-
import { required, email } from "@vuelidate/validators"
3129
3230
export default {
3331
components: {
@@ -72,6 +70,19 @@ export default {
7270
value: max.value,
7371
})
7472
}
73+
74+
watch(() => props.currentFilters[minFilterCode], (v) => {
75+
if (min.value !== v) {
76+
min.value = v;
77+
}
78+
});
79+
80+
watch(() => props.currentFilters[maxFilterCode], (v) => {
81+
if (max.value !== v) {
82+
max.value = v;
83+
}
84+
});
85+
7586
return {
7687
min,
7788
max,

packages/default-theme/src/components/listing/types/shipping-free.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
</div>
1515
</template>
1616
<script>
17-
import { computed, ref } from "@vue/composition-api"
18-
1917
import { SfFilter, SfHeading } from "@storefront-ui/vue"
2018
import SwInput from "@/components/atoms/SwInput.vue"
2119
import SwCheckbox from "@/components/atoms/SwCheckbox.vue"
@@ -30,7 +28,7 @@ export default {
3028
},
3129
data() {
3230
return {
33-
selected: this.currentFilters[this.filter.code] === "true",
31+
selected: this.currentFilters[this.filter.code] === true,
3432
}
3533
},
3634
props: {
@@ -43,6 +41,11 @@ export default {
4341
default: () => ({}),
4442
},
4543
},
44+
watch: {
45+
currentFilters(val) {
46+
this.selected = val[this.filter.code] === true;
47+
},
48+
},
4649
}
4750
</script>
4851
<style lang="scss" scoped>

0 commit comments

Comments
 (0)