From b8c7ace30eaa70a8d4a84354b2c09ea237da10c1 Mon Sep 17 00:00:00 2001 From: Richard Schreiber Date: Wed, 10 May 2023 17:41:58 +0200 Subject: [PATCH] Widget: fix quantity spinner buttons after reload (#3305) --- src/pretix/static/pretixpresale/js/widget/widget.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pretix/static/pretixpresale/js/widget/widget.js b/src/pretix/static/pretixpresale/js/widget/widget.js index 83439eca7..6b7fc98e8 100644 --- a/src/pretix/static/pretixpresale/js/widget/widget.js +++ b/src/pretix/static/pretixpresale/js/widget/widget.js @@ -221,12 +221,12 @@ Vue.component('availbox', { + '>' + '' + '
' - + '' + + '' + '' - + '' + + '' + '
' + '' + ''), @@ -253,6 +253,7 @@ Vue.component('availbox', { return this.item.require_voucher && !this.$root.voucher_code }, amount_selected: { + cache: false, get: function () { var selected = this.item.has_variations ? this.variation.amount_selected : this.item.amount_selected if (selected === 0) return undefined; @@ -267,6 +268,10 @@ Vue.component('availbox', { } else { this.item.amount_selected = value; } + if (this.$refs.quantity) { + // manually set value on quantity as on reload somehow v-model binding breaks + this.$refs.quantity.value = value; + } this.$root.$emit("amounts_changed") } }, @@ -309,7 +314,6 @@ Vue.component('availbox', { this.$root.$emit('focus_voucher_field') }, on_step: function (e) { - e.preventDefault(); var t = e.target.tagName == 'BUTTON' ? e.target : e.target.closest('button'); var step = parseFloat(t.getAttribute("data-step")); var controls = document.getElementById(t.getAttribute("data-controls"));