Notes on vue3 combined api (data transfer between parent component and child component)

Table of contents

1. Parent component rotor component

 2. Child component passes to parent component

1. Parent component rotor component

  Directly upload the code

 operation result

 2. Child component passes to parent component

Passing data from a child component to a parent component is a little more complicated and requires a deeper understanding before you can understand it! This is how I understand it

The parent component first writes a function with parameters, and then passes the function to the child component. Use defineEmits in the child component to receive the function passed by the parent component, and then create a function to call the parent component to pass the value. As long as this is triggered The function transfers the value successfully (the callback is successful), which can be understood together with the following code.

Directly upload the code

  operation result

 

Supongo que te gusta

Origin blog.csdn.net/m0_69097184/article/details/132457226
Recomendado
Clasificación