|
6 | 6 | <flow-form |
7 | 7 | ref="flowform" |
8 | 8 | v-on:complete="onComplete" |
9 | | - v-bind:questions="questions" |
10 | 9 | v-bind:language="language" |
11 | 10 | v-bind:progressbar="false" |
12 | 11 | v-bind:standalone="true" |
13 | 12 | > |
| 13 | + <question |
| 14 | + type="multipleChoice" |
| 15 | + id="multiple_choice" |
| 16 | + tagline="Welcome to our demo support page!" |
| 17 | + title="Hi 👋, how can we help you today?" |
| 18 | + v-bind:multiple="false" |
| 19 | + v-bind:helpTextShow="false" |
| 20 | + v-bind:options="[ |
| 21 | + { |
| 22 | + label: 'I have a technical issue', |
| 23 | + value: 'technical_issue' |
| 24 | + }, |
| 25 | + { |
| 26 | + label: 'I wish to check my ticket status', |
| 27 | + value: 'enter_ticket' |
| 28 | + }, |
| 29 | + ]" |
| 30 | + v-bind:jump="{ |
| 31 | + technical_issue: 'technical_issue', |
| 32 | + enter_ticket: 'enter_ticket' |
| 33 | + }" |
| 34 | + > |
| 35 | + </question> |
| 36 | + <question |
| 37 | + type="multipleChoice" |
| 38 | + id="technical_issue" |
| 39 | + tagline="Submit issue > Step 1/3" |
| 40 | + title="Have you read our technical FAQ?" |
| 41 | + v-bind:multiple="false" |
| 42 | + required |
| 43 | + v-bind:helpTextShow="false" |
| 44 | + description="Here you'll find answers to" |
| 45 | + v-bind:descriptionLink="[ |
| 46 | + { |
| 47 | + url: '#', |
| 48 | + text: 'FAQs', |
| 49 | + target: '_self' |
| 50 | + } |
| 51 | + ]" |
| 52 | + v-bind:options="[ |
| 53 | + { |
| 54 | + label: 'Yes, but I couldn’t find the answer', |
| 55 | + value: 'faq_no' |
| 56 | + } |
| 57 | + ]" |
| 58 | + v-bind:jump="{ |
| 59 | + faq_no: 'faq_no' |
| 60 | + }" |
| 61 | + > |
| 62 | + </question> |
| 63 | + <question |
| 64 | + type="text" |
| 65 | + id="enter_ticket" |
| 66 | + tagline="Support page > Ticket status" |
| 67 | + title="Please enter your 6-digit code." |
| 68 | + subtitle="You received this when you reported your problem." |
| 69 | + v-bind:multiple="false" |
| 70 | + required |
| 71 | + mask="#-#-#-#-#-#" |
| 72 | + placeholder="#-#-#-#-#-#" |
| 73 | + v-bind:jump="{ |
| 74 | + _other: '_submit' |
| 75 | + }" |
| 76 | + v-model="ticket" |
| 77 | + > |
| 78 | + </question> |
| 79 | + <question |
| 80 | + id="faq_no" |
| 81 | + tagline="Submit issue > Step 2/3" |
| 82 | + title="Please describe your problem." |
| 83 | + type="longText" |
| 84 | + required |
| 85 | + placeholder="Start typing here..." |
| 86 | + > |
| 87 | + </question> |
| 88 | + |
14 | 89 | <!-- Custom content for the Complete/Submit screen slots in the FlowForm component --> |
15 | | - <!-- We've overriden the default "complete" slot content --> |
16 | 90 | <template v-slot:complete> |
17 | 91 | <div class="f-section-wrap"> |
18 | | - <div v-if="questions[0].answer === 'technical_issue'"> |
| 92 | + <div v-if="answer === 'technical_issue'"> |
19 | 93 | <span class="f-tagline">Submit issue > Step 3/3</span> |
20 | 94 | <div v-if="loading"> |
21 | 95 | <span class="fh2">Please wait, submitting...</span> |
|
27 | 101 | </div> |
28 | 102 | <div v-else> |
29 | 103 | <span class="f-tagline">Support page > Ticket status</span> |
30 | | - <span class="fh2">Good news - the wheels are turning, your ticket is being processed!😉</span> |
| 104 | + <span class="fh2">Good news - the wheels are turning, your ticket {{ ticket }} is being processed!😉</span> |
31 | 105 | <p class="f-description"><span>Have a great day!</span></p> |
32 | 106 | </div> |
33 | 107 | </div> |
34 | 108 | </template> |
35 | | - |
36 | | - <!-- We've overriden the default "completeButton" slot content --> |
37 | | - <template v-slot:completeButton> |
38 | | - <div class="f-submit"> |
39 | | - <!-- Leave empty to hide default submit button --> |
40 | | - </div> |
41 | | - </template> |
| 109 | + <!-- We've overriden the default "complete" slot content --> |
| 110 | + |
42 | 111 | </flow-form> |
43 | 112 | </div> |
44 | 113 | </template> |
|
51 | 120 |
|
52 | 121 | // Import necessary components and classes |
53 | 122 | import FlowForm from '../../src/components/FlowForm.vue' |
54 | | - import QuestionModel, { QuestionType, ChoiceOption, LinkOption } from '../../src/models/QuestionModel' |
| 123 | + import Question from '../../src/components/Question.vue' |
55 | 124 | import LanguageModel from '../../src/models/LanguageModel' |
56 | 125 | // If using the npm package, use the following line instead of the ones above. |
57 | 126 | // import FlowForm, { QuestionModel, QuestionType, ChoiceOption, LinkOption, LanguageModel } from '@ditdot-dev/vue-flow-form' |
58 | 127 |
|
59 | 128 | export default { |
60 | 129 | name: 'example', |
61 | 130 | components: { |
62 | | - FlowForm |
| 131 | + FlowForm, |
| 132 | + Question |
63 | 133 | }, |
64 | 134 | data() { |
65 | 135 | return { |
66 | 136 | loading: false, |
67 | 137 | completed: false, |
68 | 138 | language: new LanguageModel(), |
69 | | - // Create question list with QuestionModel instances |
70 | | - questions: [ |
71 | | - new QuestionModel({ |
72 | | - id: 'multiple_choice', |
73 | | - tagline: "Welcome to our demo support page!", |
74 | | - title: 'Hi 👋, how can we help you today?', |
75 | | - type: QuestionType.MultipleChoice, |
76 | | - multiple: false, |
77 | | - required: true, |
78 | | - helpTextShow: false, |
79 | | - options: [ |
80 | | - new ChoiceOption({ |
81 | | - label: 'I have a technical issue', |
82 | | - value: 'technical_issue' |
83 | | - }), |
84 | | - new ChoiceOption({ |
85 | | - label: 'I wish to check my ticket status', |
86 | | - value: 'enter_ticket' |
87 | | - }), |
88 | | - ], |
89 | | - jump: { |
90 | | - technical_issue: 'technical_issue', |
91 | | - enter_ticket: 'enter_ticket' |
92 | | - } |
93 | | - }), |
94 | | - new QuestionModel({ |
95 | | - id: 'technical_issue', |
96 | | - tagline: 'Submit issue > Step 1/3', |
97 | | - title: 'Have you read our technical FAQ?', |
98 | | - type: QuestionType.MultipleChoice, |
99 | | - multiple: false, |
100 | | - required: true, |
101 | | - helpTextShow: false, |
102 | | - description: "Here you'll find answers to", |
103 | | - descriptionLink: [ |
104 | | - new LinkOption({ |
105 | | - url: '#', |
106 | | - text: 'FAQs', |
107 | | - target: '_self' |
108 | | - }) |
109 | | - ], |
110 | | - options: [ |
111 | | - new ChoiceOption({ |
112 | | - label: 'Yes, but I couldn’t find the answer', |
113 | | - value: 'faq_no' |
114 | | - }), |
115 | | - ], |
116 | | - jump: { |
117 | | - faq_no: 'faq_no' |
118 | | - } |
119 | | - }), |
120 | | - new QuestionModel({ |
121 | | - id: 'enter_ticket', |
122 | | - tagline: 'Support page > Ticket status', |
123 | | - title: 'Please enter your 6-digit code.', |
124 | | - subtitle: 'You received this when you reported your problem.', |
125 | | - type: QuestionType.Text, |
126 | | - multiple: false, |
127 | | - required: true, |
128 | | - mask: '#-#-#-#-#-#', |
129 | | - placeholder: '#-#-#-#-#-#', |
130 | | - jump: { |
131 | | - _other: '_submit' |
132 | | - } |
133 | | - }), |
134 | | - new QuestionModel({ |
135 | | - id: 'faq_no', |
136 | | - tagline: 'Submit issue > Step 2/3', |
137 | | - title: 'Please describe your problem.', |
138 | | - type: QuestionType.LongText, |
139 | | - required: true, |
140 | | - placeholder: 'Start typing here...', |
141 | | - }) |
142 | | - ] |
| 139 | + answer: '', |
| 140 | + ticket: '', |
143 | 141 | } |
144 | 142 | }, |
145 | 143 | methods: { |
|
157 | 155 | |
158 | 156 | onSendData() { |
159 | 157 | const self = this |
160 | | - const data = this.getData() |
| 158 | + // const data = this.getData() |
161 | 159 |
|
162 | 160 | this.loading = true |
163 | 161 | |
|
177 | 175 | self.loading = false |
178 | 176 | }, 1500) |
179 | 177 | }, |
180 | | -
|
| 178 | +/* |
181 | 179 | getData() { |
182 | 180 | const data = { |
183 | 181 | questions: [], |
|
197 | 195 | }) |
198 | 196 |
|
199 | 197 | return data |
200 | | - }, |
| 198 | + },*/ |
201 | 199 |
|
202 | 200 | getTicket() { |
203 | 201 | return Math.floor(Math.random() * (999999 - 100000) + 100000).toString() |
|
0 commit comments