Skip to content
Advertisement

Vue3 use ref from third party package in setup script

I’m using Vue 3 for my project and need to get use a ref from a third-party ReCaptcha package during the submission of a form. The code does not recognize the ref name since I did not personally create this ref:

JavaScript

It’s used in the template like this:

JavaScript

Usage can be found in the docs for this package here: https://www.npmjs.com/package/@appsbd/vue3-recaptcha

Advertisement

Answer

You need to create a ref in the script to get the element reference of recaptcha.

JavaScript

Ex:

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