英文:
Using v-for in a v-model, vuetify 3
问题
我不会再回答这个问题。
英文:
I have a v-for rendering trought input fields from the user and keep getting the same error. Somehow my property .begin from the element of the array is getting undefined
I just keep receiving the same error : Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'begin')
Thats my templateenter image description here.
And that is my Scriptenter image description here
答案1
得分: 0
在第43行的HAcademico: [this.OneActivity, this.OneActivity]
中,您正在使用this
关键字来引用同一个对象,但是this
引用的是data()
上下文,所以您需要这样做:
data() {
const oneActivity = {begin: '', end: '', type: '', text: ''}
return {
oneActivity,
HAcademico: [oneActivity, oneActivity],
}
}
英文:
in HAcademico: [this.OneActivity, this.OneActivity]
in line 43, you are using this
keyword to refer to same object, but this
refers to data()
context, so you need to do this:
data() {
const oneActivity = {begin: '', end: '', type: '', text: ''}
return {
oneActivity,
HAcademico: [oneActivity, oneActivity],
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论