Looking for assistance that relates to the following question Vue.js: Input formatting using computed property is not applying when typing quick
I am facing a challenge in extracting formatted values from text inputs and storing them in an array. I intend to organize this in a matrix structure, but for now, simplifying it into an array.
Your help would be greatly appreciated, thank you!
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<div
v-for="(input, index) in valueInputs" <-- index
:key="index"
>
<input
v-model="value" // <-- Keeping track of the current index
@input="formatTime" // <-- To be able to assign it in an array later on
maxLength="4" // I have tried formatTime[index] or value[index]
id="format-value" // but that doesn't seem to work, how can I pass the index
class="input" // to formatTime or value fields?
type="text"
/>
</div>
</div>
data () {
return {
valueInputs: [], // List of inputs
allFormatValues: [] // Intending to store all the formatted values by index here
}
}
Trying to establish an array to retain all the formatted values:
this.allFormatValues[index] = this.value;
Seeking guidance on linking the index with the formatted string value effectively...