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>
<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); }, }, }; </

©2020 ioDraw All rights reserved
python gui Interface examples -Python GUI Programming complete example IO flow —— Classification of flow ,InputStream,OutputStream,Reader,Writer etc. Thread.setDaemon Set up the Daemons STM32 RS485 modbus Communication source program , The test is effective stay MATLAB 2018 Time series prediction with deep learning vue3 Write component library and publish to npm The process of Questions and answers for the interviewer : How did you get a project in the project team ??? In the applet form Multiple cycles input How to get each input Value of 2021 Front end high frequency interview questions ( You have to watch it !!!)js Array method