I am facing a rather intriguing problem that I can't quite figure out.
Within a form, I have multiple <v-slider>
s and <v-text-field>
s. Each attribute of an object has a slider and text field using it as their v-models in the following way:
<v-slider v-model='object1.value'></v-slider>
<v-text-field v-model='object1.value'></v-text-field>
The issue is that these fields retrieve values from the Database in seconds, which can be cumbersome for users when entering values that could be more easily represented as hours or minutes. I have a <v-select>
dropdown that allows the user to choose between hours or minutes, but I'm struggling to change the value displayed on the sliders and text fields accordingly.
For example:
- The slider value is 3600 (in seconds).
- User selects
hours
from the dropdown. 3600
should then change to1
.
I've attempted setting a watcher on the dropdown change, but I keep getting NaN
when trying to manipulate the values provided.
Does anyone have any ideas on how to solve this?
EDIT: CodePen
EDIT 2:
It appears that a computed
property might be what I need, but I'm struggling to make it work. I might just move these values bound to my inputs to other variables and reassign them upon form submission.