How to call prop function from setup in vue 3

Fernando Santiago

I have the next code:

HTML:

<p @click="changeForm">Iniciar sesion</p>

JS

export default {
   name: "Register",
   props: {
      changeForm: Function,
   },
   setup() {
      //How can i call props changeForm here???
   }
}

How can i call my props function from JS? The other way around is to trigger click on my p element, is that possible?

I am using vue 3. I have tested with this.changeForm and props.changeForm with no luck.

shob

The setup function receives props as its first argument:

export default {
   name: "Register",
   props: {
     changeForm: Function,
   },
   setup(props) {            // receive `props` argument
     props.changeForm();     // use it to access `changeForm`
   }
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to pass function as a prop to child component and call it from there in Vue?

From Dev

Prop is possibly undefined error in Vue 3 setup

From Dev

How to call prop function with an argument

From Dev

Importing a function in Vue 3 setup

From Dev

Call Function From Procedure in Inno Setup?

From Dev

How to call "npm install" from Inno Setup?

From Dev

Vue3: cannot access computed prop from another computed prop when using TypeScript

From Dev

How to call a function from a list?

From Dev

How to call function from watch?

From Dev

How to call function from object

From Dev

How to call a function from wcalc?

From Dev

How to setup return_value for a function call with specific signature?

From Dev

How to access react-router v3 prop in function?

From Dev

How to trigger jQuery .change() from a .prop() function with checkboxes?

From Dev

How to call global function from the `parLapply` function?

From Dev

How to call php function from JavaScript function?

From Dev

how to call a function from another function in Jquery

From Dev

how to call javascript function from SmartGWT function

From Dev

How to call a number from another function into a function?

From Dev

How to call function from function in sql

From Dev

How to call from function to another function

From Dev

How to call a function from within another function?

From Dev

How to call $get from Vue.extend?

From Dev

How to get query params in Vue.js 3 setup?

From Dev

How to get query params in Vue.js 3 setup?

From Dev

how to call angular factory method from module setup?

From Dev

Call parent function passed as prop in React

From Java

Passing a function as a prop in Vue js to fetch data

From Dev

How to chain a function call in D3?

Related Related

  1. 1

    How to pass function as a prop to child component and call it from there in Vue?

  2. 2

    Prop is possibly undefined error in Vue 3 setup

  3. 3

    How to call prop function with an argument

  4. 4

    Importing a function in Vue 3 setup

  5. 5

    Call Function From Procedure in Inno Setup?

  6. 6

    How to call "npm install" from Inno Setup?

  7. 7

    Vue3: cannot access computed prop from another computed prop when using TypeScript

  8. 8

    How to call a function from a list?

  9. 9

    How to call function from watch?

  10. 10

    How to call function from object

  11. 11

    How to call a function from wcalc?

  12. 12

    How to setup return_value for a function call with specific signature?

  13. 13

    How to access react-router v3 prop in function?

  14. 14

    How to trigger jQuery .change() from a .prop() function with checkboxes?

  15. 15

    How to call global function from the `parLapply` function?

  16. 16

    How to call php function from JavaScript function?

  17. 17

    how to call a function from another function in Jquery

  18. 18

    how to call javascript function from SmartGWT function

  19. 19

    How to call a number from another function into a function?

  20. 20

    How to call function from function in sql

  21. 21

    How to call from function to another function

  22. 22

    How to call a function from within another function?

  23. 23

    How to call $get from Vue.extend?

  24. 24

    How to get query params in Vue.js 3 setup?

  25. 25

    How to get query params in Vue.js 3 setup?

  26. 26

    how to call angular factory method from module setup?

  27. 27

    Call parent function passed as prop in React

  28. 28

    Passing a function as a prop in Vue js to fetch data

  29. 29

    How to chain a function call in D3?

HotTag

Archive