Home > Web Front-end > JS Tutorial > body text

How to use parent component to pass value to child component in vue-prop

亚连
Release: 2018-06-02 14:25:27
Original
2156 people have browsed it

Below I will share with you an article on how to pass values ​​from a vue-prop parent component to a child component. It has a good reference value and I hope it will be helpful to everyone.

vue-prop is used by parent components to pass data to child components.

For example, the subcomponent is

child.vue

template: &#39;<p>msg: {{msg}}</p>&#39;
props: [&#39;msg&#39;],
Copy after login

We specify a data name in the subcomponent called msg

Write

<child msg="hello, vue.js!"></child>
Copy after login

in the parent component so that we can see msg in the child component: hello, vue.js!

The above is what I compiled for everyone, I hope It will be helpful to everyone in the future.

Related articles:

A kind of angular method-level cache annotation (decorator)

Solves the problem of vue routing change page data not being Refresh problem

Solve the problem of vue single page using keep-alive page to return without refreshing

The above is the detailed content of How to use parent component to pass value to child component in vue-prop. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!