Skip to content
Advertisement

TypeError: this.$refs is not a function

So I have a problem with VueJs. I created a “Confirmation Dialogue” and added it to a On-Click-Event on buttons. It worked fine.

Now I tried to copy the implementation to add it to another button on a different parent. It says “TypeError: this.$refs.confirmDialogue.show is not a function” in the Console whenever I try to click the button. The other button still works completly normal.

Am I missing something? I already tried to remove the working button, so only one component uses the Confirm Dialogue but that also didn’t work.

I’m new to VueJs. Hope someone can help me with this problem.

Child PopupModal:

JavaScript

Parent ConfirmDialogue:

JavaScript

Working button:

JavaScript

Button that isn’t working:

JavaScript

Advertisement

Answer

I got found the mistake.

I created a for-each loop to create the Table. At the working button there was no for-each loop though.

So VueJs tried to generate the Confirmation Dialogue 9 times and this resulted to an error.

So I just need to put the

JavaScript

to the top of Template like this

JavaScript

because it’s vanished and only shows when the button is clicked.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement