change interaction

This commit is contained in:
Alexander Drozdov
2020-02-12 13:51:24 +02:00
parent a90ef7d64a
commit e1aa867916
2 changed files with 10 additions and 29 deletions
+7 -18
View File
@@ -11,8 +11,7 @@
<filters-block v-if="!item.stackSize"
:filters="itemFilters"
:stats="itemStats"
:item="item"
@refine-search="refineSearch" />
:item="item" />
<trade-listing
ref="tradeService"
:filters="itemFilters"
@@ -73,20 +72,13 @@ export default {
MainProcess.priceCheckVisible(false)
}
})
},
watch: {
itemFilters: {
deep: true,
immediate: true,
handler (filters) {
if (filters == null) return
// NOTE: children component receives props on nextTick
this.$nextTick(() => {
this.$refs.tradeService.execSearch()
})
}
}
this.$watch(vm => [vm.itemFilters, vm.itemStats], () => {
// NOTE: children component receives props on nextTick
this.$nextTick(() => {
this.$refs.tradeService.execSearch()
})
}, { deep: true })
},
data () {
return {
@@ -104,9 +96,6 @@ export default {
}
},
methods: {
refineSearch () {
this.$refs.tradeService.execSearch()
}
}
}
</script>
+3 -11
View File
@@ -45,7 +45,7 @@
<div v-if="showStatsBlock && stats.length" class="my-4">
<filter-modifier v-for="filter of stats" :key="filter.id"
:filter="filter"/>
<button @click="applyStats" class="btn w-40 mt-2">Search</button>
<button @click="toggleStatsBlock" class="btn w-40 mt-2">Collapse <i class="fas fa-chevron-up pl-1 text-xs text-gray-600"></i></button>
</div>
</div>
</template>
@@ -74,7 +74,7 @@ export default {
},
data () {
return {
showStatsBlock: false
showStatsBlock: true
}
},
computed: {
@@ -84,15 +84,7 @@ export default {
},
methods: {
toggleStatsBlock () {
if (!this.showStatsBlock) {
this.showStatsBlock = true
} else {
this.applyStats()
}
},
applyStats () {
this.showStatsBlock = false
this.$emit('refine-search')
this.showStatsBlock = !this.showStatsBlock
}
}
}