0

I have a child component selectServiceChargeComponent inside a parent component (Saving Invoice Component). Child component is simply a form inside a table. If clicked on add row button new row would be formed. Problem is when I click on add row button, the following error arises:

Error photo

After looking some SO answers, I found ref would help to trigger a function in child component. So, in parent's component I used a ref inside child component and create a add row button underneath it and tried to trigger a click function addRow().

So that I could use this.$refs.serviceChargeComponent.addRow();.
But another problem came in return.

2nd problem

child Component ref

Updated Pic

2
  • It seems addRow isn't defined in your child component. Can you share your child component's code. Commented May 15, 2020 at 9:51
  • sure, it's updated Commented May 15, 2020 at 11:37

1 Answer 1

1

It looks like addRow() function is outside of methods:{}. Methods in vue should be defined inside methods: {}.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.