Home > Back-end >  Property 'positive_rule' does not exist on type '{ addMore(): void; remove(index: any
Property 'positive_rule' does not exist on type '{ addMore(): void; remove(index: any

Time:12-14

data() {
    return {
      positive_rule: [
        {
          positive_rule: "",
        },
      ],
    };
  },
methods: {
    addMore() {
      this.positive_rule.push({
        positive_rule: "",
      });
    },
   remove(index: any) {
      this.positive_rule.splice(index, 1);
    },
  }

can someone please help me by correcting this code snippet so that the 'addMore' function works cheers!

CodePudding user response:

You probably wanted to write it this way:

methods: {
addMore: () => {
  this.positive_rule.push({
    positive_rule: "",
  });
},
remove: (index: any) => {
  this.positive_rule.splice(index, 1);
},

}

  • Related