简体   繁体   English

vue中如何将数据从组件传递到主应用程序?

[英]How to pass data from the component to the main app in vue?

I'm just curious about how to pass the data from the component to the main app.我只是好奇如何将数据从组件传递到主应用程序。 like, we pass the props to the component.比如,我们将 props 传递给组件。

Props can be only send to child components.道具只能发送到子组件。

If you want to send data from child component to parent.如果要将数据从子组件发送到父组件。 It can be achieved by emit .它可以通过发射来实现。

Read this article.阅读这篇文章。 You can understand it clearly.你可以清楚地了解它。

https://www.geeksforgeeks.org/communication-between-components-using-emit-and-props-in-vue-js/ https://www.geeksforgeeks.org/communication-between-components-using-emit-and-props-in-vue-js/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Vue中如何将数据从组件传递到实例 - How to pass data from a component to an Instance in Vue Nativescript Vue(移动应用程序)-如何将模态列表视图中的选定项目数据传递回主应用程序? - Nativescript Vue (mobile app) - How to pass selected item data from listview in modal back to main app? Vue 3:当中间有路由器视图时,如何将数据从组件传递到 App.vue? - Vue 3: How to pass data from component to App.vue when there is a router-view in between? Vuejs如何使用props将数据从main.js传递到App.vue - Vuejs how to pass data from main.js to App.vue with props 是什么导致无法将 object 从主组件传递到 Vue 3 应用程序中的子组件? - What causes this failure to pass an object from the main component to a child component in a Vue 3 app? 将数据从Vue实例传递到Vue组件 - Pass the data from Vue instance to the Vue component Vue.js 无法将数据从 main.js 传递到 App.vue? - Can't pass data from main.js to App.vue in Vue js? 如何将数据从 vue 组件传递到 Laravel 中的视图(HTML) - How to pass data from vue component to view(HTML) in laravel 如何将数据从子组件传递到vue中的父组件? - How to pass data from child to parent component in vue? Vue中如何将数据从父组件传递到子组件 - How to pass data from parent to child component in Vue
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM