I am using VueJS and having one html form like below and creating dynamic inputs when clicking on "Add" button. When entering some values in that textbox, its automatically getting updated into the object.
But, problem which I am facing here is, if I enter values like 1234 or false or any string, its taking as "1234", "false", "test_value". For string, double quotes qre fine. But for numbers and booleans, how I will eliminate the quotes when entering the value. Why this is happening? Any idea regarding this?
<div class="attribute-modify-header-display pull-right">
<button type="button" name="button" @click="addNewValueInput" class="btn btn-primary">Add</button>
</div>
<table class="table vmiddle no-padding hover table-striped">
<thead>
<tr>
<td><strong>Value</strong></td>
</tr>
</thead>
<tbody >
<tr v-for="(key, index) in attributeNewArr" v-bind:key=value>
<td>
<input type="text" v-model="key.value">
</td>
</tr>
</tbody>
</table>
This is the method where I am pushing the object,
addNewValueInput: function() {
let vm = this;
vm.attributeNewArr.push({
value: '',
weight: 1 // This is default value
});
vm.$set(vm.attributeNewArr, vm.value, vm.weight);
console.log(vm.attributeNewArr);
},
While printing this,
[
{
"value": "1234",
"weight": 1
},
{
"value": "false",
"weight": 1
},
{
"value": "test_value",
"weight": 1
}
]
When printing the "attributeNewArr", always I am getting double quotes for numbers, Boolean. Any help will be much appreciated.