I have an object with key-value pair which I have used to generate textboxes using key as the label and value as the textbox value using the v-for loop. I want to add a new textbox on add button click. Here's the code.
<CRow>
<CCol sm="6">
<CDropdown toggler-text="My Test">
<CDropdownHeader>--Select--</CDropdownHeader>
<CDropdownItem
v-for="(value, key) in keys_with_empty_value"
:key="key"
>{{ key }}</CDropdownItem
>
</CDropdown>
</CCol>
<CCol sm="6">
<CButton :color="'info'" @click="addtextbox"> Add </CButton>
</CCol>
</CRow>
<CRow>
<CCol
sm="6"
v-for="(value, key, index) in keys_with_not_empty_value"
:key="key"
>
<CInput :label="key" type="text" v-model="keys_with_not_empty_value[key]" />
</CCol>
</CRow>
and my click event is :
methods:{
addtextbox() {
this.keys_with_not_empty_value.system_dummy_data = "";
},
}
I am adding new key in my object which I used in v-for and generated other textboxes. To my understanding to vue-js if I change any data in vue script part it should reflect on HTML part. but my v-for loop is not updating and I am not able to see new textbox for the newly added key.
Any suggestions would be appreciated.