|
22 | 22 | v-bind:language="language"
|
23 | 23 | v-model="dataValue"
|
24 | 24 | v-bind:active="active"
|
| 25 | + v-bind:disabled="disabled" |
25 | 26 | v-on:next="onEnter"
|
26 | 27 | />
|
27 | 28 | </span>
|
|
45 | 46 | v-bind:language="language"
|
46 | 47 | v-model="dataValue"
|
47 | 48 | v-bind:active="active"
|
| 49 | + v-bind:disabled="disabled" |
48 | 50 | v-on:next="onEnter"
|
49 | 51 | />
|
50 | 52 | </div>
|
|
70 | 72 | v-on:click.prevent="onEnter"
|
71 | 73 | v-bind:aria-label="language.ariaOk"
|
72 | 74 | >
|
73 |
| - <span v-if="question.type === QuestionType.SectionBreak">{{ language.continue }}</span> |
74 |
| - <span v-else-if="showSkip()">{{ language.skip }}</span> |
75 |
| - <span v-else>{{ language.ok }}</span> |
| 75 | + <span v-if="question.type === QuestionType.SectionBreak">{{ language.continue }}</span> |
| 76 | + <span v-else-if="showSkip()">{{ language.skip }}</span> |
| 77 | + <span v-else>{{ language.ok }}</span> |
76 | 78 | </button>
|
| 79 | + |
77 | 80 | <a
|
78 | 81 | class="f-enter-desc"
|
79 | 82 | href="#"
|
|
114 | 117 |
|
115 | 118 | export default {
|
116 | 119 | name: 'FlowFormQuestion',
|
| 120 | +
|
117 | 121 | components: {
|
118 | 122 | FlowFormDateType,
|
119 | 123 | FlowFormDropdownType,
|
|
128 | 132 | FlowFormTextType,
|
129 | 133 | FlowFormUrlType
|
130 | 134 | },
|
| 135 | +
|
131 | 136 | props: {
|
132 | 137 | question: QuestionModel,
|
133 | 138 | language: LanguageModel,
|
|
139 | 144 | reverse: {
|
140 | 145 | type: Boolean,
|
141 | 146 | default: false
|
| 147 | + }, |
| 148 | + disabled: { |
| 149 | + type: Boolean, |
| 150 | + default: false |
142 | 151 | }
|
143 | 152 | },
|
| 153 | +
|
144 | 154 | mixins: [
|
145 | 155 | IsMobile
|
146 | 156 | ],
|
| 157 | +
|
147 | 158 | data() {
|
148 | 159 | return {
|
149 | 160 | QuestionType: QuestionType,
|
150 | 161 | dataValue: null,
|
151 | 162 | debounced: false
|
152 | 163 | }
|
153 | 164 | },
|
| 165 | +
|
154 | 166 | mounted() {
|
155 | 167 | this.focusField()
|
| 168 | +
|
156 | 169 | this.dataValue = this.question.answer
|
157 | 170 |
|
158 | 171 | this.$refs.qanimate.addEventListener('animationend', this.onAnimationEnd)
|
159 | 172 | },
|
| 173 | +
|
160 | 174 | beforeDestroy() {
|
161 | 175 | this.$refs.qanimate.removeEventListener('animationend', this.onAnimationEnd)
|
162 | 176 | },
|
| 177 | +
|
163 | 178 | methods: {
|
164 | 179 | /**
|
165 | 180 | * Autofocus the input box of the current question
|
|
202 | 217 | checkAnswer(fn) {
|
203 | 218 | const q = this.$refs.questionComponent
|
204 | 219 |
|
205 |
| - if (q.isValid() && this.question.nextStepOnAnswer && !this.question.multiple) { |
206 |
| - this.debounce(() => fn(q), 350) |
| 220 | + if (q.isValid() && this.question.isMultipleChoiceType() && this.question.nextStepOnAnswer && !this.question.multiple) { |
| 221 | + this.$emit('disable', true) |
| 222 | +
|
| 223 | + this.debounce(() => { |
| 224 | + fn(q) |
| 225 | + this.$emit('disable', false) |
| 226 | + }, 350) |
207 | 227 | } else {
|
208 | 228 | fn(q)
|
209 | 229 | }
|
|
256 | 276 | return true
|
257 | 277 | }
|
258 | 278 |
|
259 |
| - if (QuestionType.MultipleChoice && !this.question.multiple && this.question.nextStepOnAnswer) { |
| 279 | + if (this.question.isMultipleChoiceType() && !this.question.multiple && this.question.nextStepOnAnswer) { |
260 | 280 | return false
|
261 | 281 | }
|
262 | 282 |
|
|
290 | 310 | return q.showInvalid()
|
291 | 311 | }
|
292 | 312 | },
|
| 313 | +
|
293 | 314 | computed: {
|
294 | 315 | mainClasses: {
|
295 | 316 | cache: false,
|
|
0 commit comments