One-way data flow explanationOne-way data flow (the heap can be modified, the stack cannot be modified) We all know that the data passed from parent to child is a one-way data flow, that is, the child component cannot directly modify the value passed by the parent component. But in fact, for modifying values, the truth is: basic data types cannot be modified, complex data types do not modify the reference address (stack), and its value can be modified at will Vue2.x usageDefine the form of the event to notify the parent component of the modification That is the most basic usage: Writing method: Use of .sync and update: When the parent component passes the value, just add The child component Writing method: Parent-to-child, shorthand for passing multiple dataIf the value passed to the child component is multiple data, you can directly include multiple data in one object with the help of v-bind ; Note: v-bind.sync="doc"; What is passed to the child component is not a doc object; But every attribute in the object. Writing method: Use v-model abbreviation (strict requirements) Parent component: Writing method: Vue3.x usage Using Common usage Use Writing method: Abbreviation When the variable passed from the parent component to the child component is named: Writing method: The above is the detailed content of the detailed explanation of the usage of the sync modifier in the parameter passing of Vue3 parent-child components. For more information about the parameter passing of Vue3 parent-child components, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: Detailed explanation of the implementation process of building a kernel tree in Ubuntu 12.04
>>: The whole process of configuring hive metadata to MySQL
I spent almost two hours trying various methods. ...
Intro Introduces and collects some simple and pra...
Reproduce on Kali First set suid permissions for ...
MySQL replication detailed explanation and simple...
Today, in the practice of vue3+vite project, when...
This is an effect created purely using CSS. To pu...
1. Introduction to DockerUI DockerUI is based on ...
There are two ways to install nodejs in linux. On...
Disk quota is the storage limit of a specified di...
Add an input file HTML control to the web page: &...
Solution: Just set the link's target attribute...
Table of contents 1. What is 2. Use Numeric Enume...
CentOS 8 is now available! CentOS 8 and RedHat En...
Docker-machine is a Docker management tool offici...
1. Setting up nginx virtual host With virtual hos...