0👍
put in a created
(or mounted
) lifecycle method and set it there.
like so:
created(){
this.form.studentId = this.studentId (assuming thats what the prop is called)
- [Vuejs]-Probleme router with localstorage password
- [Vuejs]-How to submit, a VUE / Cordova Mobile application to Apple Store?
0👍
You can use the v-model directive to create two-way data bindings on form input, textarea, and select elements.
<input v-model="message" placeholder="edit me">
To use v-model with form.studentId[n]:
- form should be a data property.
- form.studentId should be an array.
Then you can do the following:
<div v-for='classlist in classlists'>
<input v-model="form.studentId[classlist.id]">
</div>
data() {
form: {
studentId: []
}
}
Source:stackexchange.com