Closed mispp closed 4 years ago
what would be the best way to handle different types of 'value' when you want to JSON.stringify(formData)?
what i want:
{ "name": "test", "rate": 30 }
what i get:
{ "name": "test", "rate": "30" }
i've solved it like this, but this seems suboptimal.
updateForm(fieldName: string, value: any, fieldType: string) { // console.log(this.formData); if (fieldType === 'FormGeneratorInputString') { this.$set(this.formData, fieldName, value); } else { this.$set(this.formData, fieldName, Number(value)); } this.$emit('input', this.formData); },
any way to better bind types when using TypeScript?
PS. Awesome tutorial.
what would be the best way to handle different types of 'value' when you want to JSON.stringify(formData)?
what i want:
what i get:
i've solved it like this, but this seems suboptimal.
any way to better bind types when using TypeScript?
PS. Awesome tutorial.