I divide this example into several steps :

1, Of the parent component button Element binding click event , The event points to notify method
2, Register a ref=“child”
3, Of the parent component notify When dealing with , Used $refs.child Passing events to the parentMsg method , It also carries the parameters in the parent component msg
4, After receiving the parent component event , Called parentMsg method , Send the received msg put to message Array

Parent component
<template> <div id="app"> <!-- Parent component --> <input v-model="msg" /> <button v-on:click
="notify"> Broadcast events </button> <!-- Subcomponents --> <popup ref="child"></popup> </div> </template
> <script> import popup from "@/components/popup"; export default { name: "app",
data: function () { return { msg: "", }; }, components: { popup, }, methods: {
notify: function () { if (this.msg.trim()) { this.$refs.child.parentMsg(this.msg
); } }, }, }; </script> <style> #app { font-family: "Avenir", Helvetica, Arial,
sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing:
grayscale; text-align: center; color: #2c3e50; margin-top: 60px; } </style>
Subcomponents
<template> <div> <ul> <li v-for="item in messages"> The parent component entered :{{ item }}</li> </ul>
</div> </template> <style> body { background-color: #ffffff; } </style> <script>
export default { name: "popup", data: function () { return { messages: [], }; },
methods: { parentMsg: function (msg) { this.messages.push(msg); }, }, }; </
script>

Technology
©2020 ioDraw All rights reserved
synchronized Fair lock or unfair lock R language | Processing method of missing value —— multiple imputation : utilize mice() package @ControllerAdvice Intercept abnormal return data GitHub HR supervisor resigns due to dismissal of Jewish employee python Basic exercises ( One )Can not deserialize instance of java.util.ArrayList out of VALUE_TRUE tokenpytorch torchvision.transforms.Normalize() In mean and std parameter --- Dispelling doubts NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. First order low pass filter - Continuous to discrete Sources said Alibaba will cancel “361” system No coercion 10% No year-end bonus for employees