File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed
Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 124124 },
125125
126126 setAnswer (answer ) {
127+ this .question .setAnswer (answer)
128+
129+ this .answer = this .question .answer
127130 this .question .answered = this .isValid ()
128- this .answer = this .question .answer = answer
129131
130132 this .$emit (' input' , this .answer )
131133 },
Original file line number Diff line number Diff line change 1212 export default {
1313 extends: TextType,
1414 name: QuestionType .Number ,
15+
1516 data () {
1617 return {
1718 inputType: ' tel' ,
18- allowedChars: ' 0123456789.'
19+ allowedChars: ' -0123456789.'
20+ }
21+ },
22+
23+ methods: {
24+ validate () {
25+ if (this .hasValue ) {
26+ return ! isNaN (+ this .dataValue )
27+ }
28+
29+ return ! this .question .required || this .hasValue
1930 }
2031 }
2132 }
Original file line number Diff line number Diff line change @@ -122,8 +122,13 @@ export default class QuestionModel {
122122 }
123123 }
124124
125- getFormattedAnswer ( ) {
126- return this . answer
125+ setAnswer ( answer ) {
126+ console . log ( answer )
127+ if ( this . type === QuestionType . Number && answer !== '' && ! isNaN ( + answer ) ) {
128+ answer = + answer
129+ }
130+
131+ this . answer = answer
127132 }
128133
129134 getJumpId ( ) {
You can’t perform that action at this time.
0 commit comments