## 千 锋 逆 战 班 , 1902 ##

Study the second day in Qianfeng's "counter-war"

What matters in life is not where you stand, but what direction you are in;

Today is the second day of the third stage, today I reviewed the content of vue myself

I haven't been able to understand the value transfer between components before, but I finally understand today. Below is my own summary

The transmission of data between components is a one-way data flow.
1. Father and son (downward) pass value: by attribute
// 1. The attribute passed cannot be capitalized. Need to use-split. Convert uppercase to lowercase
// 2. Data received from the parent is not allowed to be modified directly.
// 3. The received attribute name is not allowed to be the same as the data name of the current component (data attribute name)
2. The child and parent (upward) pass values: through a custom event
<wrap v-show = "isShow" @ abcdefg = "changeIsShow"> </ wrap>
@click = "$ emit ('abcdefg', false)"
3. Non-father and son pass value: via bus.
* Publish and subscribe need to be in the same instance to be effective.
$ on: Receive message
$ off: Cancel subscription.
$ once: receive once
$ emit: post message

Thank you teacher Qian Feng for urging me! Come on!

Guess you like

Origin www.cnblogs.com/wufenfen/p/12683124.html