In Vuejs i have to delete a section when i click on "X" but there is some error with it

107 Views Asked by At

image of output with error on console

enter image description here

heres the picture of code where its showing error

enter image description here

1

There are 1 best solutions below

1
On

There is neither an attribute called tab nor Index in your code Define a data section and add those attributes

data() {
 return {
  tab: null,
  Index: null
 }
}

Also I don't see any usage of those variables other than in console.log. So if that's true then no need define the data() section. You can directly emit the parameter like

methods: {
  removeSection(idx) {
   this.$emit('remove', idx);
  }
}