Home  >  Q&A  >  body text

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

Output image of error on console

This is the code picture showing the error

P粉463840170P粉463840170210 days ago293

reply all(1)I'll reply

  • P粉242741921

    P粉2427419212024-03-23 00:11:08

    There is neither a property named tab nor a property named Index in your code Define the data section and add these properties

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

    Also, I don't see any use of these variables other than console.log. So if this were true, there would be no need to define the data() part. You can directly emit parameters like

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

    reply
    0
  • Cancelreply